gnucash maint: Fix gnc_iso8601_to_timespec_gmt test failure.

John Ralls jralls at code.gnucash.org
Mon Jun 20 18:29:32 EDT 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/2375270e (commit)
	from  https://github.com/Gnucash/gnucash/commit/a6da796c (commit)



commit 2375270eb782a23ce4ad58715b4daab28d2e5bed
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jun 20 15:29:21 2016 -0700

    Fix gnc_iso8601_to_timespec_gmt test failure.
    
    Triggered by colon in the zone string.

diff --git a/src/libqof/qof/gnc-date.c b/src/libqof/qof/gnc-date.c
index d06a028..d84e950 100644
--- a/src/libqof/qof/gnc-date.c
+++ b/src/libqof/qof/gnc-date.c
@@ -1440,8 +1440,14 @@ gnc_iso8601_to_timespec_gmt(const char *str)
 	GTimeZone *tz = NULL;
         time64 secs;
 	int plus = strspn(zone, "+-");
-	long offset = strtol(zone, NULL, 10);
+        char *colon = NULL;
+	long offset = strtol(zone, &colon, 10);
 	gboolean adjust_time = FALSE;
+        if (colon != NULL)
+        {
+            long zone_minutes = strtol(colon + 1, NULL, 10);
+            offset = 100 * offset + zone_minutes;
+        }
 	/* Bug 767824: A GLib bug in parsing the UTC timezone on
 	 * Windows may have created a bogus timezone of a random
 	 * number of minutes. Since there are no fractional-hour



Summary of changes:
 src/libqof/qof/gnc-date.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list