mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
datetime: fix second parsing failure case when deserialising datetime
When we fail to parse the number of seconds, reset the value to -1 instead of passing some error value as seconds. Also, we can still try to parse timezone information.
This commit is contained in:
parent
1c43e3628d
commit
dcc9941931
1 changed files with 6 additions and 3 deletions
|
@ -771,16 +771,19 @@ gst_date_time_new_from_iso8601_string (const gchar * string)
|
||||||
if (hour > 24 || *string != ':')
|
if (hour > 24 || *string != ':')
|
||||||
goto ymd;
|
goto ymd;
|
||||||
|
|
||||||
|
/* minute */
|
||||||
minute = g_ascii_strtoull (string + 1, (gchar **) & string, 10);
|
minute = g_ascii_strtoull (string + 1, (gchar **) & string, 10);
|
||||||
if (minute > 59)
|
if (minute > 59)
|
||||||
goto ymd;
|
goto ymd;
|
||||||
|
|
||||||
|
/* second */
|
||||||
if (*string == ':') {
|
if (*string == ':') {
|
||||||
second = g_ascii_strtoull (string + 1, (gchar **) & string, 10);
|
second = g_ascii_strtoull (string + 1, (gchar **) & string, 10);
|
||||||
/* if we fail here, we still can reuse hour and minute. We
|
/* if we fail here, we still can reuse hour and minute. We
|
||||||
* will also fall of to tzoffset = 0.0 */
|
* will still attempt to parse any timezone information */
|
||||||
if (second > 59)
|
if (second > 59) {
|
||||||
goto ymd_hms;
|
second = -1.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*string == 'Z')
|
if (*string == 'Z')
|
||||||
|
|
Loading…
Reference in a new issue