diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Omtime.c | 12 | ||||
-rw-r--r-- | src/H5system.c | 31 | ||||
-rw-r--r-- | src/H5win32defs.h | 6 |
3 files changed, 32 insertions, 17 deletions
diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 32248fa..d8c5305 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -186,12 +186,6 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 int i; struct tm tm; void *ret_value = NULL; /* Return value */ -#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; -#endif FUNC_ENTER_NOAPI_NOINIT @@ -232,11 +226,7 @@ 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 - HDget_timezone(&timezone); - #endif - /* GNU/Linux systems */ - the_time -= timezone - (tm.tm_isdst ? 3600 : 0); + the_time -= HDget_timezone() - (tm.tm_isdst ? 3600 : 0); #else /* * The catch-all. If we can't convert a character string universal diff --git a/src/H5system.c b/src/H5system.c index e00e5a5..098c109 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -586,6 +586,37 @@ void HDsrand(unsigned int seed) /*------------------------------------------------------------------------- + * Function: HDget_timezone + * + * Purpose: Wrapper function for global variable timezone, if it exists + * on this system, or use the function if VS2015 + * + * VS2015 removed the deprecated global variable timezone. + * + * Return: Success: The value of timezone + * + * Failure: Cannot fail. + * + *------------------------------------------------------------------------- + */ +#ifdef H5_HAVE_TIMEZONE + +long HDget_timezone(void) +{ +#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; + + #define HDget_timezone(V) _get_timezone(V); + HDget_timezone(&timezone); +#endif + return timezone; +} +#endif /* H5_HAVE_TIMEZONE */ + +/*------------------------------------------------------------------------- * Function: Wgettimeofday * * Purpose: Wrapper function for gettimeofday on Windows systems diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 58e1412..73d8417 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -84,12 +84,6 @@ struct timezone { #define HDgetlogin() Wgetlogin() #define HDsnprintf c99_snprintf /*varargs*/ #define HDvsnprintf c99_vsnprintf -#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. - #define HDget_timezone(V) _get_timezone(V); -#endif #endif /* H5_HAVE_VISUAL_STUDIO */ |