diff options
Diffstat (limited to 'src/third_party/wiredtiger/src/os_posix/os_time.c')
-rw-r--r-- | src/third_party/wiredtiger/src/os_posix/os_time.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/third_party/wiredtiger/src/os_posix/os_time.c b/src/third_party/wiredtiger/src/os_posix/os_time.c index b1b22a8e684..719e214696b 100644 --- a/src/third_party/wiredtiger/src/os_posix/os_time.c +++ b/src/third_party/wiredtiger/src/os_posix/os_time.c @@ -12,26 +12,35 @@ * __wt_epoch -- * Return the time since the Epoch. */ -int +void __wt_epoch(WT_SESSION_IMPL *session, struct timespec *tsp) { WT_DECL_RET; + /* + * This function doesn't return an error, but panics on failure (which + * should never happen, it's done this way to simplify error handling + * in the caller). However, some compilers complain about using garbage + * values. Initializing the values avoids the complaint. + */ + tsp->tv_sec = 0; + tsp->tv_nsec = 0; + #if defined(HAVE_CLOCK_GETTIME) - WT_SYSCALL(clock_gettime(CLOCK_REALTIME, tsp), ret); + WT_SYSCALL_RETRY(clock_gettime(CLOCK_REALTIME, tsp), ret); if (ret == 0) - return (0); - WT_RET_MSG(session, ret, "clock_gettime"); + return; + WT_PANIC_MSG(session, ret, "clock_gettime"); #elif defined(HAVE_GETTIMEOFDAY) struct timeval v; - WT_SYSCALL(gettimeofday(&v, NULL), ret); + WT_SYSCALL_RETRY(gettimeofday(&v, NULL), ret); if (ret == 0) { tsp->tv_sec = v.tv_sec; tsp->tv_nsec = v.tv_usec * WT_THOUSAND; - return (0); + return; } - WT_RET_MSG(session, ret, "gettimeofday"); + WT_PANIC_MSG(session, ret, "gettimeofday"); #else NO TIME-OF-DAY IMPLEMENTATION: see src/os_posix/os_time.c #endif |