[svn-r28236] Rework get timezone function to add another exclusion define (H5_HAVA_TM_GMTOFF).

Also needed to add prototype - followed lead of HDrand.
Tested linux and windows
This commit is contained in:
Allen Byrne 2015-10-27 10:22:09 -05:00
parent 8e179b17aa
commit 3537b69b5b
3 changed files with 17 additions and 5 deletions

View File

@ -226,7 +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)
the_time -= HDget_timezone() - (tm.tm_isdst ? 3600 : 0);
the_time -= HDgettimezone() - (tm.tm_isdst ? 3600 : 0);
#else
/*
* The catch-all. If we can't convert a character string universal

View File

@ -495,7 +495,7 @@
#endif
/* Double constant wrapper
*
*
* Quiets gcc warnings from -Wunsuffixed-float-constants.
*
* This is a really annoying warning since the standard specifies that
@ -935,6 +935,14 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#ifndef HDgets
#define HDgets(S) gets(S)
#endif /* HDgets */
#ifndef H5_HAVE_TM_GMTOFF
#ifdef H5_HAVE_TIMEZONE
#ifndef HDgettimezone
#define HDgettimezone() HDget_timezone()
#endif /* HDgettimezone */
H5_DLL int HDget_timezone(void);
#endif /* H5_HAVE_TIMEZONE */
#endif /* H5_HAVE_TM_GMTOFF */
#ifndef HDgettimeofday
#define HDgettimeofday(S,P) gettimeofday(S,P)
#endif /* HDgettimeofday */
@ -2065,7 +2073,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */
FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI
/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI
* and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set
* up a metadata tag. */
#define FUNC_ENTER_NOAPI_TAG(dxpl_id, tag, err) { \

View File

@ -599,24 +599,28 @@ void HDsrand(unsigned int seed)
*
*-------------------------------------------------------------------------
*/
#ifndef H5_HAVE_TM_GMTOFF
#ifdef H5_HAVE_TIMEZONE
long HDget_timezone(void)
long int HDget_timezone(void)
{
#ifdef H5_HAVE_VISUAL_STUDIO
#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;
long int timezone = 0;
#define HDget_timezone(V) _get_timezone(V);
HDget_timezone(&timezone);
#endif
#endif
return timezone;
}
#endif /* H5_HAVE_TIMEZONE */
#endif /* H5_HAVE_TM_GMTOFF */
/*-------------------------------------------------------------------------
* Function: Wgettimeofday