From 94e6dcbf50f3bf0991e246d5e175941ced937991 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Tue, 7 Oct 2014 21:33:02 +0000 Subject: [PATCH] Fix cygwin compilation warning on geotag.cpp --- samples/geotag.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/samples/geotag.cpp b/samples/geotag.cpp index 427bf0e3..c60286d6 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -417,7 +417,6 @@ time_t parseTime(const char* arg,bool bAdjust) int timeZoneAdjust() { time_t now = time(NULL); - struct tm local = *localtime(&now) ; int offset; #if defined(_MSC_VER) @@ -425,15 +424,17 @@ int timeZoneAdjust() GetTimeZoneInformation( &TimeZoneInfo ); offset = - (((int)TimeZoneInfo.Bias + (int)TimeZoneInfo.DaylightBias) * 60); #elif defined(__CYGWIN__) - struct tm lcopy = *localtime(&now); - time_t gmt = timegm(&lcopy) ; // timegm modifies lcopy, so don't use local - offset = (int) ( ((long signed int) gmt) - ((long signed int) now) ) ; + struct tm lcopy = *localtime(&now); + time_t gmt = timegm(&lcopy) ; // timegm modifies lcopy + offset = (int) ( ((long signed int) gmt) - ((long signed int) now) ) ; #elif defined(OS_SOLARIS) + struct tm local = *localtime(&now) ; time_t local_tt = (int) mktime(&local); time_t time_gmt = (int) mktime(gmtime(&now)); - offset = time_gmt - local_tt; + offset = time_gmt - local_tt; #else - offset = local.tm_gmtoff ; + struct tm local = *localtime(&now) ; + offset = local.tm_gmtoff ; #endif #if 0