diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-10-10 13:59:08 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-10-10 14:31:54 +0200 |
commit | 4e28ffbc89597ad9367a997ab52790ca1786b0af (patch) | |
tree | 5ad1ecd82312bea96b34e7dfde9fe3d7d1506d49 | |
parent | 9a0a37563cc58868177a3cac3bf377edb810458d (diff) | |
download | tracker-4e28ffbc89597ad9367a997ab52790ca1786b0af.tar.gz |
libtracker-common: Ensure to print at least 4 year digits
Expand the %F in strftime() to %4Y-%M-%D, otherwise for years < 1000
we end up eating digits, and producing a not quite ISO8601 string.
Fixes: https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/146
-rw-r--r-- | src/libtracker-common/tracker-date-time.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libtracker-common/tracker-date-time.c b/src/libtracker-common/tracker-date-time.c index 03ee078d5..003239f6a 100644 --- a/src/libtracker-common/tracker-date-time.c +++ b/src/libtracker-common/tracker-date-time.c @@ -222,7 +222,7 @@ tracker_date_to_string (gdouble date_time, gmtime_r (&seconds, &utc_time); /* Output is ISO 8601 format : "YYYY-MM-DDThh:mm:ss" */ - count = strftime (buffer, sizeof (buffer), "%FT%T", &utc_time); + count = strftime (buffer, sizeof (buffer), "%4Y-%m-%dT%T", &utc_time); /* Append milliseconds (if non-zero) and time zone */ if (milliseconds > 0) { |