From 29381f9e70d122ea4d89d71ea97f42253c528211 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sun, 7 May 2017 15:21:39 +0200 Subject: jpeg-utils: Allow custom datetime format The default locale datetime format string may not suit everyone, this adds possibility to specify custom format. The format string should be syntactically conforming to strftime(3). --- src/jpeg-utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/jpeg-utils.cpp') diff --git a/src/jpeg-utils.cpp b/src/jpeg-utils.cpp index e9e1e65..61aeebd 100644 --- a/src/jpeg-utils.cpp +++ b/src/jpeg-utils.cpp @@ -289,7 +289,7 @@ get_exif_data_fixed (ExifData *exif, const gchar *key) if (exif->override_datetime != (time_t) -1) { tt = (struct tm *) g_malloc0 (sizeof (struct tm)); localtime_r (&exif->override_datetime, tt); - if (strftime (&conv[0], sizeof (conv), "%c", tt)) + if (strftime (&conv[0], sizeof (conv), exif->datetime_format ? exif->datetime_format : "%c", tt)) res = g_strdup (&conv[0]); } @@ -297,7 +297,7 @@ get_exif_data_fixed (ExifData *exif, const gchar *key) tt = parse_exif_date (val); if (tt) { shift_time (tt, exif->timezone_shift); - if (strftime (&conv[0], sizeof (conv), "%c", tt)) + if (strftime (&conv[0], sizeof (conv), exif->datetime_format ? exif->datetime_format : "%c", tt)) res = g_strdup (&conv[0]); } } -- cgit v1.2.3