summaryrefslogtreecommitdiffstats
path: root/src/H5Fvfd_swmr.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-03 01:22:22 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-03 01:22:22 (GMT)
commit94694f91a3cb723106d677c7e3e2ea3fe8c702e0 (patch)
treea31d871580ca2776d366a47ac49a6083a483512a /src/H5Fvfd_swmr.c
parenteb24fbe89c5040b531bd79dafd5a50552f434d50 (diff)
downloadhdf5-94694f91a3cb723106d677c7e3e2ea3fe8c702e0.zip
hdf5-94694f91a3cb723106d677c7e3e2ea3fe8c702e0.tar.gz
hdf5-94694f91a3cb723106d677c7e3e2ea3fe8c702e0.tar.bz2
Engineers around naked clock_gettime() calls
This is a temporary solution, as not all POSIX platforms will have clock_gettime(). Further code fixes will be required. With this change, the main C library should compile on Windows.
Diffstat (limited to 'src/H5Fvfd_swmr.c')
-rw-r--r--src/H5Fvfd_swmr.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c
index 76748fe..0b0befd 100644
--- a/src/H5Fvfd_swmr.c
+++ b/src/H5Fvfd_swmr.c
@@ -1502,10 +1502,14 @@ H5F__vfd_swmr_update_end_of_tick_and_tick_num(H5F_shared_t *shared,
FUNC_ENTER_STATIC
/* Get current time in struct timespec */
- if ( HDclock_gettime(CLOCK_MONOTONIC, &curr) < 0 )
-
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, \
- "can't get time via clock_gettime")
+#ifdef H5_HAVE_WIN32_API
+ if (timespec_get(&curr, TIME_UTC) != TIME_UTC)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time via timespec_get");
+#else
+ if (HDclock_gettime(CLOCK_MONOTONIC, &curr) < 0) {
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time via clock_gettime");
+ }
+#endif
/* Convert curr to nsecs */
curr_nsecs = curr.tv_sec * nanosecs_per_second + curr.tv_nsec;
@@ -1952,10 +1956,14 @@ H5F_vfd_swmr_process_eot_queue(hbool_t entering_api)
H5F_t *f = head->vfd_swmr_file;
H5F_shared_t *shared = f->shared;
+#ifdef H5_HAVE_WIN32_API
+ if(timespec_get(&now, TIME_UTC) != TIME_UTC)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time via timespec_get");
+#else
if(HDclock_gettime(CLOCK_MONOTONIC, &now) < 0) {
- HGOTO_ERROR(H5E_FUNC, H5E_CANTGET, FAIL,
- "can't get time via clock_gettime");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time via clock_gettime");
}
+#endif
if(timespeccmp(&now, &head->end_of_tick, <))
break;
/* If the H5F_shared_t is labeled with a later EOT time than