GNOME Bugzilla – Bug 762438
[PATCH] format_utc_offset returning bogus results
Last modified: 2017-04-17 18:20:40 UTC
Created attachment 321824 [details] [review] fix format_utc_offset While looking into some offset issues I noticed format_utc_offset is called in two different ways. One is by icaltimezone_get_utc_offset which returns seconds (and in my case is always 0 afaics) and the other is g_date_time_get_utc_offset which returns a GTimeSpan (gint64). The latter returned bogus results with offset being defined as gint. Adapted the function to handle both possibilities.
Review of attachment 321824 [details] [review]: It makes sense, only small nitpicks. ::: src/gcal-utils.c @@ +804,3 @@ } + if (offset >= 1000000) { Please, add a comment before explaining why this check is needed here. @@ +806,3 @@ + if (offset >= 1000000) { + offset = offset / 1000000; + } Don't add curly braces here.
Created attachment 321885 [details] [review] fix format_utc_offset
Review of attachment 321885 [details] [review]: ::: src/gcal-utils.c @@ +806,3 @@ + /* offset can be seconds or microseconds */ + if (offset >= 1000000) + offset = offset / 1000000; Now that I'm looking... does this code works with negative timezones?
Created attachment 322189 [details] [review] fix format_utc_offset Definitely, just before that the code makes sure the offset is positive: https://git.gnome.org/browse/gnome-calendar/tree/src/gcal-utils.c#n801 . Patch updated only commit msg formatting.
Cool. I wrote that code, and forgot about it :) Anyway, thanks for working on that.