GNOME Bugzilla – Bug 506074
Fractional timezone offsets not always handled correctly
Last modified: 2018-06-29 21:57:34 UTC
I was experiencing a failure in src/engine/test/test-transaction-voiding: "bad void time". I eventually tracked this down to a problem in the gnc_timespec_to_iso8601_buff function when using a timezone with a fractional offset east of UTC. The timezone I am using is UTC+4:30. Thus an example output from gnc_timespec_to_iso8601_buff should be something like: "2007-12-27 23:09:19.000000 +0430" However, I was getting output with a negative sign before the timezone minutes, like: "2007-12-27 23:09:19.000000 +04-30" This is because the code was negating the tz_hour variable (if it was negative), but not the tz_min variable (gnc_timezone() returns negative values for offsets east of UTC).
Created attachment 101731 [details] [review] Fix timezone offset handling in gnc_timespec_to_iso8601_buff This patch fixes the issue by negating secs (if it is negative) before computing tz_hour and tz_min, rather than negating tz_hour. Thus tz_hour and tz_min will always be positive. As before, the sign character is stored in the cyn variable. With this patch, test-transaction-voiding now passes on my system.
Applied as r16776. I have marked it for backport to branches/2.2 as I could imagine that in those time zones times and dates could have changed after write&read.
branches/2.2 @ r16800 for GnuCash 2.2.3. Thanks a lot!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=506074. Please update any external references or bookmarks.