From 081a4f33e2da17066f8136c73ea7b47b4d6be928 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Sat, 17 Nov 2018 20:07:33 +0000 Subject: [PATCH] Show timezone data when no date-time Make available GPS lat/long derived data Timezone, Country Name, Country Code even when there is no GPS date and time available. --- src/exif-common.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/exif-common.c b/src/exif-common.c index ba6c06d0..ce562eb3 100644 --- a/src/exif-common.c +++ b/src/exif-common.c @@ -662,7 +662,7 @@ static void zd_tz(ZoneDetectResult *results, gchar **timezone, gchar **countryna /** * @brief Gets timezone data from an exif structure * @param[in] exif - * @returns TRUE if timezone data found + * @returns TRUE if timezone data found AND GPS date and time found * @param[out] exif_date_time exif date/time in the form 2018:11:30:17:05:04 * @param[out] timezone in the form "Europe/London" * @param[out] countryname in the form "United Kingdom" @@ -696,11 +696,8 @@ static gboolean exif_build_tz_data(ExifData *exif, gchar **exif_date_time, gchar text_date = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSDateStamp"); text_time = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSTimeStamp"); - if (text_latitude && text_longitude && text_latitude_ref && - text_longitude_ref && text_date && text_time) + if (text_latitude && text_longitude && text_latitude_ref && text_longitude_ref) { - *exif_date_time = g_strconcat(text_date, ":", text_time, NULL); - lat_deg = strtok(text_latitude, "deg'"); lat_min = strtok(NULL, "deg'"); latitude = atof(lat_deg) + atof(lat_min) / 60; @@ -738,6 +735,14 @@ static gboolean exif_build_tz_data(ExifData *exif, gchar **exif_date_time, gchar g_free(zd_path); } + if (ret && text_date && text_time) + { + *exif_date_time = g_strconcat(text_date, ":", text_time, NULL); + } + else + { + ret = FALSE; + } return ret; } -- 2.20.1