isc_loop_now() is a front-end to uv_now(), returning the start
time of the current event loop tick.
* Requires:
*\li 'loop' is a valid loop.
*/
+
+isc_time_t
+isc_loop_now(isc_loop_t *loop);
+/*%<
+ * Returns the start time of the current loop tick.
+ *
+ * Requires:
+ *
+ * \li 'loop' is a valid loop.
+ */
ISC_LANG_ENDDECLS
#include <isc/strerr.h>
#include <isc/thread.h>
#include <isc/tid.h>
+#include <isc/time.h>
#include <isc/urcu.h>
#include <isc/util.h>
#include <isc/uv.h>
return (loop->loopmgr);
}
+
+isc_time_t
+isc_loop_now(isc_loop_t *loop) {
+ REQUIRE(VALID_LOOP(loop));
+
+ uint64_t msec = uv_now(&loop->loop);
+ isc_time_t t = {
+ .seconds = msec / MS_PER_SEC,
+ .nanoseconds = (msec % MS_PER_SEC) * NS_PER_MS,
+ };
+
+ return (t);
+}