datetime: Return G_MAXFLOAT instead of G_MAXDOUBLE for no timezone offset

Returning G_MAXDOUBLE from a function returning a float is not going to
work well and MSVC also correctly warns about this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4264>
This commit is contained in:
Sebastian Dröge 2023-03-24 18:34:36 +02:00 committed by GStreamer Marge Bot
parent 8541d6b990
commit 49c9f31803

View file

@ -334,7 +334,7 @@ gst_date_time_get_microsecond (const GstDateTime * datetime)
* values, timezones before (to the west) of UTC have negative values. * values, timezones before (to the west) of UTC have negative values.
* If @datetime represents UTC time, then the offset is zero. * If @datetime represents UTC time, then the offset is zero.
* *
* Return value: the offset from UTC in hours, or %G_MAXDOUBLE if none is set. * Return value: the offset from UTC in hours, or %G_MAXFLOAT if none is set.
*/ */
gfloat gfloat
gst_date_time_get_time_zone_offset (const GstDateTime * datetime) gst_date_time_get_time_zone_offset (const GstDateTime * datetime)
@ -342,7 +342,7 @@ gst_date_time_get_time_zone_offset (const GstDateTime * datetime)
g_return_val_if_fail (datetime != NULL, 0.0); g_return_val_if_fail (datetime != NULL, 0.0);
if (!gst_date_time_has_time (datetime)) if (!gst_date_time_has_time (datetime))
return G_MAXDOUBLE; return G_MAXFLOAT;
return (g_date_time_get_utc_offset (datetime->datetime) / return (g_date_time_get_utc_offset (datetime->datetime) /
G_USEC_PER_SEC) / 3600.0; G_USEC_PER_SEC) / 3600.0;