* to CLOCK_REALTIME. */
static clockid_t monotonic_clock;
-/* Has a timer tick occurred? Only relevant if CACHE_TIME is 1.
+/* Has a timer tick occurred? Only relevant if CACHE_TIME is true.
*
* We initialize these to true to force time_init() to get called on the first
* call to time_msec() or another function that queries the current time. */
VLOG_DBG("monotonic timer not available");
}
- if (CACHE_TIME) {
- set_up_signal(SA_RESTART);
- set_up_timer();
- }
+ set_up_signal(SA_RESTART);
+ set_up_timer();
boot_time = time_msec();
}
static timer_t timer_id; /* "static" to avoid apparent memory leak. */
struct itimerspec itimer;
+ if (!CACHE_TIME) {
+ return;
+ }
+
if (timer_create(monotonic_clock, NULL, &timer_id)) {
VLOG_FATAL("timer_create failed (%s)", strerror(errno));
}
time_postfork(void)
{
time_init();
-
- if (CACHE_TIME) {
- set_up_timer();
- }
+ set_up_timer();
}
static void
/* Forces a refresh of the current time from the kernel. It is not usually
* necessary to call this function, since the time will be refreshed
* automatically at least every TIME_UPDATE_INTERVAL milliseconds. If
- * CACHE_TIME is 0, we will always refresh the current time so this
+ * CACHE_TIME is false, we will always refresh the current time so this
* function has no effect. */
void
time_refresh(void)