Commit 6035b4c0 authored by Carlos Garnacho's avatar Carlos Garnacho

tracker-extract-gstreamer: Fix iso 8601 string generation in negative TZs

We try to format the timezone hour difference with %02d, however for
negative numbers it will contain just eg. "-4", which is not the expected
behavior.

So, take the negative sign out of the integer, and add it separately
just like we do for the explicit '+'. This makes the %02d bit actually
correct, so the timezone bit starts with "-04".

GNOME/tracker#22

Closes: tracker#22
parent 12903399
...@@ -230,7 +230,7 @@ get_gst_date_time_to_buf (GstDateTime *date_time, ...@@ -230,7 +230,7 @@ get_gst_date_time_to_buf (GstDateTime *date_time,
if (gst_date_time_has_time (date_time)) { if (gst_date_time_has_time (date_time)) {
hour = gst_date_time_get_hour (date_time); hour = gst_date_time_get_hour (date_time);
minute = gst_date_time_get_minute (date_time); minute = gst_date_time_get_minute (date_time);
offset_str = gst_date_time_get_time_zone_offset (date_time) >= 0 ? "+" : ""; offset_str = gst_date_time_get_time_zone_offset (date_time) >= 0 ? "+" : "-";
offset = gst_date_time_get_time_zone_offset (date_time); offset = gst_date_time_get_time_zone_offset (date_time);
} else { } else {
offset_str = "+"; offset_str = "+";
...@@ -245,7 +245,7 @@ get_gst_date_time_to_buf (GstDateTime *date_time, ...@@ -245,7 +245,7 @@ get_gst_date_time_to_buf (GstDateTime *date_time,
minute, minute,
second, second,
offset_str, offset_str,
(gint) offset); (gint) ABS (offset));
return complete; return complete;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment