mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 13:08:49 +00:00
datetime: Make use of new g_time_zone_new_identifier() that properly handles errors
g_time_zone_new() returns UTC if it fails to parse the timezone identifier, which is rather suboptimal and causes wrong datetimes to be created silently. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/706>
This commit is contained in:
parent
9f23808b55
commit
cf0f39efe8
1 changed files with 8 additions and 0 deletions
|
@ -763,7 +763,15 @@ gst_date_time_new (gfloat tzoffset, gint year, gint month, gint day, gint hour,
|
|||
g_snprintf (buf, 6, "%c%02d%02d", tzoffset >= 0 ? '+' : '-', tzhour,
|
||||
tzminute);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 67, 1)
|
||||
/* g_time_zone_new() would always return UTC if the identifier can't be
|
||||
* parsed, which is rather suboptimal. */
|
||||
tz = g_time_zone_new_identifier (buf);
|
||||
if (!tz)
|
||||
return NULL;
|
||||
#else
|
||||
tz = g_time_zone_new (buf);
|
||||
#endif
|
||||
|
||||
fields = gst_date_time_check_fields (&year, &month, &day,
|
||||
&hour, &minute, &seconds);
|
||||
|
|
Loading…
Reference in a new issue