From bb5cdf6360308dce34546f55d02f8073b88dd748 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Tue, 26 Apr 2022 15:26:03 -0400 Subject: [PATCH 5/6] Use roborio time --- src/unix/linux-core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/unix/linux-core.c b/src/unix/linux-core.c index a66bb535..8a267823 100644 --- a/src/unix/linux-core.c +++ b/src/unix/linux-core.c @@ -67,6 +67,10 @@ # define CLOCK_MONOTONIC_COARSE 6 #endif +#ifdef __FRC_ROBORIO__ +#include "wpi/timestamp.h" +#endif + /* This is rather annoying: CLOCK_BOOTTIME lives in but we can't * include that file because it conflicts with . We'll just have to * define it ourselves. @@ -424,6 +428,9 @@ update_timeout: uint64_t uv__hrtime(uv_clocktype_t type) { +#ifdef __FRC_ROBORIO__ + return wpi::Now() * 1000u; +#else static clock_t fast_clock_id = -1; struct timespec t; clock_t clock_id; @@ -453,6 +460,7 @@ uint64_t uv__hrtime(uv_clocktype_t type) { return 0; /* Not really possible. */ return t.tv_sec * (uint64_t) 1e9 + t.tv_nsec; +#endif } -- 2.20.1.windows.1