2 * this header includes functions to support broken systems
3 * without clock_gettime() or CLOCK_MONOTONIC
6 #ifndef HAVE_CLOCK_GETTIME
7 # ifndef CLOCK_REALTIME
8 # define CLOCK_REALTIME 0 /* whatever */
10 static int fake_clock_gettime(int clk_id
, struct timespec
*res
)
13 int r
= gettimeofday(&tv
, NULL
);
15 assert(0 == r
&& "gettimeofday() broke!?");
16 res
->tv_sec
= tv
.tv_sec
;
17 res
->tv_nsec
= tv
.tv_usec
* 1000;
21 # define clock_gettime fake_clock_gettime
22 #endif /* broken systems w/o clock_gettime() */
25 #ifndef _POSIX_MONOTONIC_CLOCK
26 # define CLOCK_MONOTONIC CLOCK_REALTIME