2
* See the file LICENSE for redistribution information.
4
* Copyright (c) 2001-2002
5
* Sleepycat Software. All rights reserved.
11
static const char revid[] = "$Id$";
14
#ifndef NO_SYSTEM_INCLUDES
15
#include <sys/types.h>
17
#if TIME_WITH_SYS_TIME
25
#endif /* HAVE_SYS_TIME_H */
26
#endif /* TIME_WITH SYS_TIME */
35
* Return the current time-of-day clock in seconds and microseconds.
37
* PUBLIC: int __os_clock __P((DB_ENV *, u_int32_t *, u_int32_t *));
40
__os_clock(dbenv, secsp, usecsp)
42
u_int32_t *secsp, *usecsp; /* Seconds and microseconds. */
44
#if defined(HAVE_GETTIMEOFDAY)
48
retry: if (gettimeofday(&tp, NULL) != 0) {
49
if ((ret = __os_get_errno()) == EINTR)
51
__db_err(dbenv, "gettimeofday: %s", strerror(ret));
60
#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_CLOCK_GETTIME)
64
retry: if (clock_gettime(CLOCK_REALTIME, &tp) != 0) {
65
if ((ret = __os_get_errno()) == EINTR)
67
__db_err(dbenv, "clock_gettime: %s", strerror(ret));
74
*usecsp = tp.tv_nsec / 1000;
76
#if !defined(HAVE_GETTIMEOFDAY) && !defined(HAVE_CLOCK_GETTIME)
80
if (time(&now) == (time_t)-1) {
81
ret = __os_get_errno();
82
__db_err(dbenv, "time: %s", strerror(ret));