diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-03-10 07:41:24 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-03-10 07:41:24 (GMT) |
commit | 4a2a4bd95b8c0ce284f428be5ddcf937b5ce7662 (patch) | |
tree | 6015f9f170222985c5d1efacb9396c629c18cb43 /src/H5Omtime.c | |
parent | 6b1176f34e780cd597f32991ae3952ea371c66fe (diff) | |
download | hdf5-4a2a4bd95b8c0ce284f428be5ddcf937b5ce7662.zip hdf5-4a2a4bd95b8c0ce284f428be5ddcf937b5ce7662.tar.gz hdf5-4a2a4bd95b8c0ce284f428be5ddcf937b5ce7662.tar.bz2 |
[svn-r26413] Merge of r26276 from trunk.
Cleans up time functions in the autotools input files.
- Lumps all the time functionality together in configure.ac.
This was previously more spread out due to Solaris issues
with the ordering of certain checks.
- Removes processing that handles __tm_gmtoff members of struct
tm. (libc-4)
- Removes BSDgettimeofday(). (IRIX 5.3)
- Removes timezone struct processing in gettimeofday(). (considered
harmful)
Fixes: HDFFV-9083 and HDFFV-9085
Tested on: h5committest
OS X (quail)
Solaris (emu)
Diffstat (limited to 'src/H5Omtime.c')
-rw-r--r-- | src/H5Omtime.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/src/H5Omtime.c b/src/H5Omtime.c index e719e08..a3703b5 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -194,8 +194,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, /* decode */ for(i = 0; i < 14; i++) - if(!HDisdigit(p[i])) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") + if(!HDisdigit(p[i])) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") /* * Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic @@ -213,36 +213,14 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0'); tm.tm_isdst = -1; /*figure it out*/ if((time_t)-1 == (the_time = HDmktime(&tm))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") #if defined(H5_HAVE_TM_GMTOFF) - /* FreeBSD, OSF 4.0 */ + /* BSD-like systems */ the_time += tm.tm_gmtoff; -#elif defined(H5_HAVE___TM_GMTOFF) - /* Linux libc-4 */ - the_time += tm.__tm_gmtoff; #elif defined(H5_HAVE_TIMEZONE) - /* Linux libc-5 */ - the_time -= timezone - (tm.tm_isdst?3600:0); -#elif defined(H5_HAVE_BSDGETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) - /* Irix5.3 */ - { - struct timezone tz; - - if(HDBSDgettimeofday(NULL, &tz) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") - the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0); - } -#elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) && defined(H5_GETTIMEOFDAY_GIVES_TZ) - { - struct timezone tz; - struct timeval tv; /* Used as a placebo; some systems don't like NULL */ - - if(HDgettimeofday(&tv, &tz) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") - - the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0); - } + /* GNU/Linux systems */ + the_time -= timezone - (tm.tm_isdst ? 3600 : 0); #else /* * The catch-all. If we can't convert a character string universal @@ -251,14 +229,12 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, * only way a user can get the modification time is from our internal * query routines, which can gracefully recover. */ - - /* Irix64 */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") #endif /* The return value */ if(NULL == (mesg = H5FL_MALLOC(time_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") *mesg = the_time; /* Set return value */ |