#endif
#include "event2/event-config.h"
+#include <time.h>
#include <sys/queue.h>
#include "event2/event_struct.h"
#include "minheap-internal.h"
/** Priority queue of events with timeouts. */
struct min_heap timeheap;
- /** Stored timeval: used to avoid calling gettimeofday too often. */
+ /** Stored timeval: used to avoid calling gettimeofday/clock_gettime
+ * too often. */
struct timeval tv_cache;
+#if defined(_EVENT_HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+ /** Difference between internal time (maybe from clock_gettime) and
+ * gettimeofday. */
+ struct timeval tv_clock_diff;
+ /** Second in which we last updated tv_clock_diff, in monotonic time. */
+ time_t last_updated_clock_diff;
+#endif
+
#ifndef _EVENT_DISABLE_THREAD_SUPPORT
/* threading support */
/** The thread currently running the event_loop for this base */