r16800 - gnucash/branches/2.2/lib/libqof/qof - [r16776] #506074: Handle fractional timezone offsets correctly in gnc_timespec_to_iso8601_buff().
Andreas Köhler
andi5 at cvs.gnucash.org
Fri Jan 4 19:53:27 EST 2008
Author: andi5
Date: 2008-01-04 19:53:26 -0500 (Fri, 04 Jan 2008)
New Revision: 16800
Trac: http://svn.gnucash.org/trac/changeset/16800
Modified:
gnucash/branches/2.2/lib/libqof/qof/gnc-date.c
Log:
[r16776] #506074: Handle fractional timezone offsets correctly in gnc_timespec_to_iso8601_buff().
Patch from Daniel Harding.
Approved by andrewsw.
Modified: gnucash/branches/2.2/lib/libqof/qof/gnc-date.c
===================================================================
--- gnucash/branches/2.2/lib/libqof/qof/gnc-date.c 2008-01-05 00:53:16 UTC (rev 16799)
+++ gnucash/branches/2.2/lib/libqof/qof/gnc-date.c 2008-01-05 00:53:26 UTC (rev 16800)
@@ -1164,15 +1164,16 @@
localtime_r(&tmp, &parsed);
secs = gnc_timezone (&parsed);
- tz_hour = secs / 3600;
- tz_min = (secs % 3600) / 60;
/* We also have to print the sign by hand, to work around a bug
* in the glibc 2.1.3 printf (where %+02d fails to zero-pad).
*/
cyn = '-';
- if (0>tz_hour) { cyn = '+'; tz_hour = -tz_hour; }
+ if (0>secs) { cyn = '+'; secs = -secs; }
+ tz_hour = secs / 3600;
+ tz_min = (secs % 3600) / 60;
+
len = sprintf (buff, "%4d-%02d-%02d %02d:%02d:%02d.%06ld %c%02d%02d",
parsed.tm_year + 1900,
parsed.tm_mon + 1,
More information about the gnucash-changes
mailing list