diff options
author | Peter Kjellerstedt <pkj@axis.com> | 2009-04-08 10:26:11 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2009-04-08 10:26:11 -0400 |
commit | efc2cdbfc981754db361f49c30c8ee24ac0c769e (patch) | |
tree | ba610330d4b420c19c484e3b1e0ee72ba740a9f6 /glib | |
parent | d0cf7b38780b0832fc904f75eb387aa61eb2f76e (diff) | |
download | glib-efc2cdbfc981754db361f49c30c8ee24ac0c769e.tar.gz |
Fix parsing of timezones
Make g_time_val_from_iso8601 handle timezones with minutes correctly;
also accept comma as a fraction separator. (#578369)
Diffstat (limited to 'glib')
-rw-r--r-- | glib/gtimer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/glib/gtimer.c b/glib/gtimer.c index 3221c1aaf..c52eeb7fe 100644 --- a/glib/gtimer.c +++ b/glib/gtimer.c @@ -367,7 +367,7 @@ g_time_val_from_iso8601 (const gchar *iso_date, time_->tv_sec = mktime_utc (&tm); time_->tv_usec = 0; - if (*iso_date == '.') + if (*iso_date == ',' || *iso_date == '.') { glong mul = 100000; @@ -382,14 +382,14 @@ g_time_val_from_iso8601 (const gchar *iso_date, { gint sign = (*iso_date == '+') ? -1 : 1; - val = 60 * strtoul (iso_date + 1, (char **)&iso_date, 10); + val = strtoul (iso_date + 1, (char **)&iso_date, 10); if (*iso_date == ':') val = 60 * val + strtoul (iso_date + 1, (char **)&iso_date, 10); else val = 60 * (val / 100) + (val % 100); - time_->tv_sec += (time_t) (val * sign); + time_->tv_sec += (time_t) (60 * val * sign); } else if (*iso_date++ != 'Z') return FALSE; |