summaryrefslogtreecommitdiff
path: root/gst/gstdatetime.c
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2012-07-07 16:01:41 +0100
committerTim-Philipp Müller <tim@centricular.net>2012-07-07 19:05:55 +0100
commitdcc9941931fa350f1eef0e05d691f66d05abd3c4 (patch)
tree13bc804bff512aa1556b5d6be785e31af36f69d6 /gst/gstdatetime.c
parent1c43e3628dab154b73e284fd48bbd7374141b51e (diff)
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.
Diffstat (limited to 'gst/gstdatetime.c')
-rw-r--r--gst/gstdatetime.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gst/gstdatetime.c b/gst/gstdatetime.c
index 2784e443e3..e1905afdf7 100644
--- a/gst/gstdatetime.c
+++ b/gst/gstdatetime.c
@@ -771,16 +771,19 @@ gst_date_time_new_from_iso8601_string (const gchar * string)
if (hour > 24 || *string != ':')
goto ymd;
+ /* minute */
minute = g_ascii_strtoull (string + 1, (gchar **) & string, 10);
if (minute > 59)
goto ymd;
+ /* second */
if (*string == ':') {
second = g_ascii_strtoull (string + 1, (gchar **) & string, 10);
/* if we fail here, we still can reuse hour and minute. We
- * will also fall of to tzoffset = 0.0 */
- if (second > 59)
- goto ymd_hms;
+ * will still attempt to parse any timezone information */
+ if (second > 59) {
+ second = -1.0;
+ }
}
if (*string == 'Z')