From 5d303b9c2d59e67b9802d98bf886259dfd544600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Mon, 31 Dec 2007 13:52:24 +0000 Subject: [PATCH] #506074: Handle fractional timezone offsets correctly in gnc_timespec_to_iso8601_buff(). Patch from Daniel Harding BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16776 57a11ea4-9604-0410-9ed3-97b8803252fd --- lib/libqof/qof/gnc-date.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libqof/qof/gnc-date.c b/lib/libqof/qof/gnc-date.c index fd5550208f..5104a8b227 100644 --- a/lib/libqof/qof/gnc-date.c +++ b/lib/libqof/qof/gnc-date.c @@ -1164,14 +1164,15 @@ gnc_timespec_to_iso8601_buff (Timespec ts, char * buff) 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,