diff options
Diffstat (limited to 'deps/uv/src/unix/freebsd.c')
-rw-r--r-- | deps/uv/src/unix/freebsd.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/deps/uv/src/unix/freebsd.c b/deps/uv/src/unix/freebsd.c index c838beb28e..c69608b139 100644 --- a/deps/uv/src/unix/freebsd.c +++ b/deps/uv/src/unix/freebsd.c @@ -240,17 +240,13 @@ error: int uv_uptime(double* uptime) { - time_t now; - struct timeval info; - size_t size = sizeof(info); - static int which[] = {CTL_KERN, KERN_BOOTTIME}; - - if (sysctl(which, 2, &info, &size, NULL, 0)) + int r; + struct timespec sp; + r = clock_gettime(CLOCK_MONOTONIC, &sp); + if (r) return -errno; - now = time(NULL); - - *uptime = (double)(now - info.tv_sec); + *uptime = sp.tv_sec; return 0; } |