changeset 2864:9104756a7828

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.
author Colin Clark <colin.clark@cclark.uk>
date Sat, 17 Nov 2018 20:07:33 +0000
parents 4b92a65f8367
children cb5326e72117
files src/exif-common.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/exif-common.c	Sat Nov 17 19:48:35 2018 +0000
+++ b/src/exif-common.c	Sat Nov 17 20:07:33 2018 +0000
@@ -662,7 +662,7 @@
 /**
  * @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 @@
 	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 @@
 		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;
 }