diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2015-10-26 20:40:30 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2015-10-26 20:40:30 (GMT) |
commit | b7310b0d1f1042ed14928b378852e034231f6747 (patch) | |
tree | 3a43dec6213941e62ea903f4ff0a92a462c9ce58 /src/H5system.c | |
parent | 00aaf8e6f45fed0e4a1dcce9de230826009e0b39 (diff) | |
download | hdf5-b7310b0d1f1042ed14928b378852e034231f6747.zip hdf5-b7310b0d1f1042ed14928b378852e034231f6747.tar.gz hdf5-b7310b0d1f1042ed14928b378852e034231f6747.tar.bz2 |
[svn-r28229] HDFFV-9550: Rework timezone usage to localize the #ifdef blocks to a HDget_timezone function.
Diffstat (limited to 'src/H5system.c')
-rw-r--r-- | src/H5system.c | 31 |
1 files changed, 31 insertions, 0 deletions
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 |