mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Merge branch 'wip/hadess/gdatetime-leap-seconds' into 'master'
gdatetime: Add hack for leap seconds Closes #1938 See merge request GNOME/glib!1233
This commit is contained in:
commit
a0d5b49ef7
@ -1194,6 +1194,11 @@ get_iso8601_seconds (const gchar *text, gsize length, gdouble *value)
|
|||||||
|
|
||||||
if (length > 2 && !(text[i] == '.' || text[i] == ','))
|
if (length > 2 && !(text[i] == '.' || text[i] == ','))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
/* Ignore leap seconds, see g_date_time_new_from_iso8601() */
|
||||||
|
if (v >= 60.0 && v <= 61.0)
|
||||||
|
v = 59.0;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
if (i == length)
|
if (i == length)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1433,6 +1438,10 @@ parse_iso8601_time (const gchar *text, gsize length,
|
|||||||
* some extensions from [RFC 3339](https://tools.ietf.org/html/rfc3339) as
|
* some extensions from [RFC 3339](https://tools.ietf.org/html/rfc3339) as
|
||||||
* mentioned below.
|
* mentioned below.
|
||||||
*
|
*
|
||||||
|
* Note that as #GDateTime "is oblivious to leap seconds", leap seconds information
|
||||||
|
* in an ISO-8601 string will be ignored, so a `23:59:60` time would be parsed as
|
||||||
|
* `23:59:59`.
|
||||||
|
*
|
||||||
* <sep> is the separator and can be either 'T', 't' or ' '. The latter two
|
* <sep> is the separator and can be either 'T', 't' or ' '. The latter two
|
||||||
* separators are an extension from
|
* separators are an extension from
|
||||||
* [RFC 3339](https://tools.ietf.org/html/rfc3339#section-5.6).
|
* [RFC 3339](https://tools.ietf.org/html/rfc3339#section-5.6).
|
||||||
|
@ -818,6 +818,7 @@ test_GDateTime_new_from_iso8601_2 (void)
|
|||||||
{ TRUE, "1970-01-01T00:00:17.1234Z", 1970, 1, 1, 0, 0, 17, 123400, 0 },
|
{ TRUE, "1970-01-01T00:00:17.1234Z", 1970, 1, 1, 0, 0, 17, 123400, 0 },
|
||||||
{ TRUE, "1970-01-01T00:00:17.123456Z", 1970, 1, 1, 0, 0, 17, 123456, 0 },
|
{ TRUE, "1970-01-01T00:00:17.123456Z", 1970, 1, 1, 0, 0, 17, 123456, 0 },
|
||||||
{ TRUE, "1980-02-22T12:36:00+02:00", 1980, 2, 22, 12, 36, 0, 0, 2 * G_TIME_SPAN_HOUR },
|
{ TRUE, "1980-02-22T12:36:00+02:00", 1980, 2, 22, 12, 36, 0, 0, 2 * G_TIME_SPAN_HOUR },
|
||||||
|
{ TRUE, "1990-12-31T15:59:60-08:00", 1990, 12, 31, 15, 59, 59, 0, -8 * G_TIME_SPAN_HOUR },
|
||||||
{ FALSE, " ", 0, 0, 0, 0, 0, 0, 0, 0 },
|
{ FALSE, " ", 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||||
{ FALSE, "x", 0, 0, 0, 0, 0, 0, 0, 0 },
|
{ FALSE, "x", 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||||
{ FALSE, "123x", 0, 0, 0, 0, 0, 0, 0, 0 },
|
{ FALSE, "123x", 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||||
|
Loading…
Reference in New Issue
Block a user