#653196 libglib2.0-0: g_time_val_from_iso8601 doesn't handle YYYY-MM-DD dates correctly

Package:
libglib2.0-0
Source:
glib2.0
Description:
GLib library of C routines
Submitter:
Vincent Lefevre
Date:
2011-12-25 01:09:05 UTC
Severity:
normal
#653196#5
Date:
2011-12-25 00:58:42 UTC
From:
To:
g_time_val_from_iso8601 doesn't handle YYYY-MM-DD dates correctly.
For instance, when debugging Liferea with:

time_t
date_parse_ISO8601 (const gchar *date)
{
        GTimeVal        tv;
        gboolean b;

        g_warning ("Date: %s", date);
        b = g_time_val_from_iso8601 (date, &tv);
        if (b == TRUE) {
          gchar *s;
          s = g_time_val_to_iso8601 (&tv);
          g_warning (" was: %s", s);
          g_free (s);
        }

        return (time_t)tv.tv_sec;
}

I get:

** (liferea:10394): WARNING **: Date: 2011-12-24

** (liferea:10394): WARNING **:  was: 1970-08-18T05:43:44Z

** (liferea:10394): WARNING **: Date: 2011-12-22

** (liferea:10394): WARNING **:  was: 1970-08-18T06:35:12Z

Note: if g_time_val_from_iso8601 isn't meant to support YYYY-MM-DD
dates (the current documentation is unclear), then the returned
boolean should not be true!