static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */
static EV_ATOMIC_T monotinic_clock_id;
#endif
+static EV_ATOMIC_T have_cheap_timer = 0;
#ifndef EV_FD_TO_WIN32_HANDLE
# define EV_FD_TO_WIN32_HANDLE(fd) _get_osfhandle (fd)
!clock_getres ((id), &ts)) { \
if (ts.tv_sec == 0 && ts.tv_nsec < 10ULL * 1000000) { \
monotinic_clock_id = (id); \
+ have_cheap_timer = 1; \
} \
} \
} while(0)
time_update (EV_A_ 1e100);
}
+void
+ev_now_update_if_cheap (EV_P) EV_NOEXCEPT
+{
+ if (have_cheap_timer) time_update (EV_A_ 1e100);
+}
+
void
ev_suspend (EV_P) EV_NOEXCEPT
{
EV_API_DECL unsigned int ev_backend (EV_P) EV_NOEXCEPT; /* backend in use by loop */
EV_API_DECL void ev_now_update (EV_P) EV_NOEXCEPT; /* update event loop time */
+/*
+ * Same as ev_now_update, but will update time merely if cheap (coarse) timers
+ * are used in system.
+ */
+EV_API_DECL void ev_now_update_if_cheap (EV_P) EV_NOEXCEPT;
#if EV_WALK_ENABLE
/* walk (almost) all watchers in the loop of a given type, invoking the */