diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-07-14 17:02:43 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-07-14 17:02:43 (GMT) |
commit | 900e75544e214a82de3b7fcdbc083ee71d484892 (patch) | |
tree | ff64f549eb7c9f4dcab13b55c9f2fa80a54bf8f7 | |
parent | 9224c7abaa536bbdea2bfb6fc3b268c693a087d7 (diff) | |
parent | 806f5b5b2a280072f62f58c48e93acdc84f2b3ae (diff) | |
download | hdf5-900e75544e214a82de3b7fcdbc083ee71d484892.zip hdf5-900e75544e214a82de3b7fcdbc083ee71d484892.tar.gz hdf5-900e75544e214a82de3b7fcdbc083ee71d484892.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '806f5b5b2a280072f62f58c48e93acdc84f2b3ae':
Removed POSIX #defines from configure on Solaris.
Fallback to older time functions in new timer code.
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/H5timer.c | 31 |
2 files changed, 8 insertions, 29 deletions
diff --git a/configure.ac b/configure.ac index 670b0eb..f79e9e6 100644 --- a/configure.ac +++ b/configure.ac @@ -1250,12 +1250,6 @@ case "$host_cpu-$host_vendor-$host_os" in H5_CPPFLAGS="-D_GNU_SOURCE $H5_CPPFLAGS" ;; - *solaris*) - ## Solaris also needs _POSIX_C_SOURCE set correctly to pick up - ## clock_gettime(). - H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS" - H5_CPPFLAGS="-D_GNU_SOURCE $H5_CPPFLAGS" - ;; esac ## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible diff --git a/src/H5timer.c b/src/H5timer.c index 8f3d305..cef7bf9 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -220,7 +220,8 @@ H5_now_usec(void) * * Purpose: Get the current time, as the time of seconds after the UNIX epoch * - * Return: SUCCEED/FAIL + * Return: Success: A non-negative time value + * Failure: -1.0 (in theory, can't currently fail) * * Programmer: Quincey Koziol * October 05, 2016 @@ -247,9 +248,9 @@ H5_get_time(void) HDgettimeofday(&now_tv, NULL); ret_value = (double)now_tv.tv_sec + ((double)now_tv.tv_usec / (double)1000000.0f); } -#else /* H5_HAVE_GETTIMEOFDAY */ +#else ret_value = (double)HDtime(NULL); -#endif /* H5_HAVE_GETTIMEOFDAY */ +#endif FUNC_LEAVE_NOAPI(ret_value) } /* end H5_get_time() */ @@ -279,9 +280,9 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) /* Windows call handles both system/user and elapsed times */ #ifdef H5_HAVE_WIN32_API if(H5_get_win32_times(times) < 0) { - times->elapsed = -1; - times->system = -1; - times->user = -1; + times->elapsed = -1.0; + times->system = -1.0; + times->user = -1.0; return -1; } /* end if */ @@ -310,24 +311,8 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) * Elapsed time * ****************/ - /* NOTE: Not having a way to get elapsed time IS an error, unlike - * the system and user times. - */ + times->elapsed = H5_get_time(); -#if defined(H5_HAVE_CLOCK_GETTIME) -{ - struct timespec ts; - - if(HDclock_gettime(CLOCK_MONOTONIC, &ts) != 0) - return -1; - times->elapsed = (double)ts.tv_sec + ((double)ts.tv_nsec / (double)1.0E9F); -} -#else - /* Die here. We'd like to know about this so we can support some - * other time functionality. - */ - HDassert(0); -#endif #endif /* H5_HAVE_WIN32_API */ return 0; |