summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-07-23 17:29:16 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-07-23 17:29:16 (GMT)
commit375f0745a7a07cf430d92a755297e372b3a4b420 (patch)
tree9bb35f5eff95aa772729865941c13c579e1eed59 /src
parent48e8092c66c7d637d6b6975e4985aa26604f6228 (diff)
downloadhdf5-375f0745a7a07cf430d92a755297e372b3a4b420.zip
hdf5-375f0745a7a07cf430d92a755297e372b3a4b420.tar.gz
hdf5-375f0745a7a07cf430d92a755297e372b3a4b420.tar.bz2
[svn-r8938]
Purpose: Bug fix Description: Modification time test (mtime) would die silently on some systems. This is because the code is very system-dependant (it relies on getting the current time and the timezone from the OS). Solution: mtime test now uses TEST_ERROR macro to print "FAILED" and to output where the failure occurred. Configure script is a little smarter about whether gettimeofday() function returns the timezone correctly. Further bugs will need to be addressed on a system-by-system basis. Platforms tested: sleipnir, arabica, verbena, copper, windows (VC7)
Diffstat (limited to 'src')
-rw-r--r--src/H5Omtime.c8
-rw-r--r--src/H5config.h.in3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 9e9702d..bc6a604 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -233,11 +233,12 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p,
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)
+#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(NULL, &tz) < 0)
+ 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);
@@ -251,7 +252,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p,
tz = timebuffer.timezone;
/* daylight is not handled properly. Currently we just hard-code
the problem. */
- the_time -= tz*60;
+/* the_time -= tz*60; */
+ the_time -= tz * 60 - 3600;
/* the_time -= tz * 60 - 3600 * _daylight;*/
}
#else
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 6695396..2a01753 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -377,6 +377,9 @@
/* Define if `__tm_gmtoff' is a member of `struct tm' */
#undef HAVE___TM_GMTOFF
+/* Define if gettimeofday() populates the tz pointer passed in */
+#undef GETTIMEOFDAY_GIVES_TZ
+
/* Define if your system's `MPI_File_set_size' function works for files over
2GB. */
#undef MPI_FILE_SET_SIZE_BIG