summaryrefslogtreecommitdiffstats
path: root/src/H5Omtime.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-07-23 17:24:59 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-07-23 17:24:59 (GMT)
commit8d843938ba8275f8a52f32a26b5f6829830e3a8a (patch)
tree5db430aecc45fc1c7cd7783eab72ad0f1806c10d /src/H5Omtime.c
parent12ee450f700800de37600494353e39e8be59e928 (diff)
downloadhdf5-8d843938ba8275f8a52f32a26b5f6829830e3a8a.zip
hdf5-8d843938ba8275f8a52f32a26b5f6829830e3a8a.tar.gz
hdf5-8d843938ba8275f8a52f32a26b5f6829830e3a8a.tar.bz2
[svn-r8937]
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/H5Omtime.c')
-rw-r--r--src/H5Omtime.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index ac99bc1..2c53950 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -233,15 +233,17 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p,
/* 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)
+#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);
@@ -250,12 +252,13 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p,
{
struct timeb timebuffer;
long tz;
-
+
ftime(&timebuffer);
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