From aa4284b2a3ce1908f339bd07da0370c493d71b89 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 21 Oct 2015 16:22:06 -0500 Subject: [svn-r28174] HDFFV-9550: Add VS2015 fix for timezone. --- config/cmake_ext_mod/ConfigureChecks.cmake | 4 +--- src/H5Omtime.c | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 94e5be1..d41923e 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -90,9 +90,7 @@ if (WINDOWS) endif (NOT UNIX AND NOT CYGWIN AND NOT MINGW) set (${HDF_PREFIX}_HAVE_FUNCTION 1) set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) - if (MSVC_VERSION LESS 1900) - set (${HDF_PREFIX}_HAVE_TIMEZONE 1) - endif (MSVC_VERSION LESS 1900) + set (${HDF_PREFIX}_HAVE_TIMEZONE 1) set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) if (MINGW) set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 622d57d..cac5aca 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -226,6 +226,13 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 /* BSD-like systems */ the_time += tm.tm_gmtoff; #elif defined(H5_HAVE_TIMEZONE) + #if _MSC_VER >= 1900 // VS 2015 + // In gcc and in Visual Studio prior to VS 2015 'timezone' is a global + // variable declared in time.h. That variable was deprecated and in VS 2015 + // is removed, with _get_timezone replacing it. + long timezone = 0; + _get_timezone(&timezone); + #endif /* GNU/Linux systems */ the_time -= timezone - (tm.tm_isdst ? 3600 : 0); #else -- cgit v0.12