After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 506074 - Fractional timezone offsets not always handled correctly
Fractional timezone offsets not always handled correctly
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: Engine
git-master
Other All
: Normal major
: ---
Assigned To: Derek Atkins
Derek Atkins
Depends on:
Blocks: backport
 
 
Reported: 2007-12-28 14:43 UTC by Daniel Harding
Modified: 2018-06-29 21:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix timezone offset handling in gnc_timespec_to_iso8601_buff (807 bytes, patch)
2007-12-28 14:46 UTC, Daniel Harding
committed Details | Review

Description Daniel Harding 2007-12-28 14:43:26 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).
Comment 1 Daniel Harding 2007-12-28 14:46:47 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.
Comment 2 Andreas Köhler 2007-12-31 13:57:47 UTC
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.
Comment 3 Andreas Köhler 2008-01-05 01:09:46 UTC
branches/2.2 @ r16800 for GnuCash 2.2.3.
Thanks a lot!
Comment 4 John Ralls 2018-06-29 21:57:34 UTC
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.