diff --git a/src/unix/aix.c b/src/unix/aix.c index 5637e871..5ea33bbc 100644 --- a/src/unix/aix.c +++ b/src/unix/aix.c @@ -45,7 +45,7 @@ #include #include -uint64_t uv_hrtime() { +uint64_t uv__hrtime(void) { uint64_t G = 1000000000; timebasestruct_t t; read_wall_time(&t, TIMEBASE_SZ); diff --git a/src/unix/core.c b/src/unix/core.c index 88a752cd..def4a892 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -66,6 +66,11 @@ static uv_loop_t default_loop_struct; static uv_loop_t* default_loop_ptr; +uint64_t uv_hrtime(void) { + return uv__hrtime(); +} + + void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { assert(!(handle->flags & (UV_CLOSING | UV_CLOSED))); @@ -302,7 +307,7 @@ int uv_run(uv_loop_t* loop) { void uv_update_time(uv_loop_t* loop) { - loop->time = uv_hrtime() / 1000000; + loop->time = uv__hrtime() / 1000000; } diff --git a/src/unix/cygwin.c b/src/unix/cygwin.c index 8c0797e4..ee9659df 100644 --- a/src/unix/cygwin.c +++ b/src/unix/cygwin.c @@ -41,12 +41,13 @@ void uv__platform_loop_delete(uv_loop_t* loop) { } -uint64_t uv_hrtime() { +uint64_t uv__hrtime(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); } + void uv_loadavg(double avg[3]) { /* Unsupported as of cygwin 1.7.7 */ avg[0] = avg[1] = avg[2] = 0; diff --git a/src/unix/darwin.c b/src/unix/darwin.c index f40efb2f..b5cba863 100644 --- a/src/unix/darwin.c +++ b/src/unix/darwin.c @@ -176,7 +176,7 @@ void uv__cf_loop_signal(uv_loop_t* loop, cf_loop_signal_cb cb, void* arg) { } -uint64_t uv_hrtime(void) { +uint64_t uv__hrtime(void) { mach_timebase_info_data_t info; if (mach_timebase_info(&info) != KERN_SUCCESS) diff --git a/src/unix/freebsd.c b/src/unix/freebsd.c index 4a32f6ee..44b1ef3d 100644 --- a/src/unix/freebsd.c +++ b/src/unix/freebsd.c @@ -63,7 +63,7 @@ void uv__platform_loop_delete(uv_loop_t* loop) { } -uint64_t uv_hrtime(void) { +uint64_t uv__hrtime(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); diff --git a/src/unix/internal.h b/src/unix/internal.h index d1768e0a..5f04dc29 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -174,6 +174,7 @@ void uv__work_submit(uv_loop_t* loop, void uv__work_done(uv_async_t* handle, int status); /* platform specific */ +uint64_t uv__hrtime(void); int uv__kqueue_init(uv_loop_t* loop); int uv__platform_loop_init(uv_loop_t* loop, int default_loop); void uv__platform_loop_delete(uv_loop_t* loop); diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c index af9078e9..50208901 100644 --- a/src/unix/kqueue.c +++ b/src/unix/kqueue.c @@ -244,7 +244,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { update_timeout: assert(timeout > 0); - diff = uv_hrtime() / 1000000; + diff = uv__hrtime() / 1000000; assert(diff >= base); diff -= base; diff --git a/src/unix/linux/linux-core.c b/src/unix/linux/linux-core.c index 95df6676..28e1141f 100644 --- a/src/unix/linux/linux-core.c +++ b/src/unix/linux/linux-core.c @@ -243,7 +243,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { update_timeout: assert(timeout > 0); - diff = uv_hrtime() / 1000000; + diff = uv__hrtime() / 1000000; assert(diff >= base); diff -= base; @@ -255,7 +255,7 @@ update_timeout: } -uint64_t uv_hrtime() { +uint64_t uv__hrtime(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); diff --git a/src/unix/loop.c b/src/unix/loop.c index e63f12a6..5672abe9 100644 --- a/src/unix/loop.c +++ b/src/unix/loop.c @@ -49,7 +49,7 @@ int uv__loop_init(uv_loop_t* loop, int default_loop) { ngx_queue_init(&loop->watcher_queue); loop->closing_handles = NULL; - loop->time = uv_hrtime() / 1000000; + loop->time = uv__hrtime() / 1000000; loop->async_pipefd[0] = -1; loop->async_pipefd[1] = -1; loop->signal_pipefd[0] = -1; diff --git a/src/unix/netbsd.c b/src/unix/netbsd.c index d9fb426d..0fbcf108 100644 --- a/src/unix/netbsd.c +++ b/src/unix/netbsd.c @@ -56,7 +56,7 @@ void uv__platform_loop_delete(uv_loop_t* loop) { } -uint64_t uv_hrtime(void) { +uint64_t uv__hrtime(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); diff --git a/src/unix/openbsd.c b/src/unix/openbsd.c index 88f20b01..4dfcd76b 100644 --- a/src/unix/openbsd.c +++ b/src/unix/openbsd.c @@ -52,7 +52,7 @@ void uv__platform_loop_delete(uv_loop_t* loop) { } -uint64_t uv_hrtime(void) { +uint64_t uv__hrtime(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); diff --git a/src/unix/sunos.c b/src/unix/sunos.c index ec00d453..db5a9c8b 100644 --- a/src/unix/sunos.c +++ b/src/unix/sunos.c @@ -211,7 +211,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { update_timeout: assert(timeout > 0); - diff = uv_hrtime() / 1000000; + diff = uv__hrtime() / 1000000; assert(diff >= base); diff -= base; @@ -223,8 +223,8 @@ update_timeout: } -uint64_t uv_hrtime() { - return (gethrtime()); +uint64_t uv__hrtime(void) { + return gethrtime(); } diff --git a/src/unix/thread.c b/src/unix/thread.c index 0583cb47..4fd5d2f5 100644 --- a/src/unix/thread.c +++ b/src/unix/thread.c @@ -354,7 +354,7 @@ int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) { struct timespec ts; uint64_t abstime; - abstime = uv_hrtime() + timeout; + abstime = uv__hrtime() + timeout; ts.tv_sec = abstime / NANOSEC; ts.tv_nsec = abstime % NANOSEC; r = pthread_cond_timedwait(cond, mutex, &ts);