diff --git a/include/uv-private/uv-win.h b/include/uv-private/uv-win.h index 82c0cff1..574aa8f2 100644 --- a/include/uv-private/uv-win.h +++ b/include/uv-private/uv-win.h @@ -487,8 +487,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); #define UV_TIMER_PRIVATE_FIELDS \ RB_ENTRY(uv_timer_s) tree_entry; \ - int64_t due; \ - int64_t repeat; \ + uint64_t due; \ + uint64_t repeat; \ uint64_t start_id; \ uv_timer_cb timer_cb; diff --git a/include/uv.h b/include/uv.h index e1eaf81e..453b90c4 100644 --- a/include/uv.h +++ b/include/uv.h @@ -1170,15 +1170,11 @@ UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle); * * If repeat is non-zero, the callback fires first after timeout milliseconds * and then repeatedly after repeat milliseconds. - * - * timeout and repeat are signed integers but that will change in a future - * version of libuv. Don't pass in negative values, you'll get a nasty surprise - * when that change becomes effective. */ UV_EXTERN int uv_timer_start(uv_timer_t* handle, uv_timer_cb cb, - int64_t timeout, - int64_t repeat); + uint64_t timeout, + uint64_t repeat); UV_EXTERN int uv_timer_stop(uv_timer_t* handle); @@ -1195,9 +1191,9 @@ UV_EXTERN int uv_timer_again(uv_timer_t* handle); * non-repeating before, it will have been stopped. If it was repeating, then * the old repeat value will have been used to schedule the next timeout. */ -UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, int64_t repeat); +UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat); -UV_EXTERN int64_t uv_timer_get_repeat(uv_timer_t* handle); +UV_EXTERN uint64_t uv_timer_get_repeat(uv_timer_t* handle); /* diff --git a/src/unix/timer.c b/src/unix/timer.c index 2c2458d0..5c4208ec 100644 --- a/src/unix/timer.c +++ b/src/unix/timer.c @@ -52,11 +52,8 @@ int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) { int uv_timer_start(uv_timer_t* handle, uv_timer_cb cb, - int64_t timeout, - int64_t repeat) { - assert(timeout >= 0); - assert(repeat >= 0); - + uint64_t timeout, + uint64_t repeat) { if (uv__is_active(handle)) uv_timer_stop(handle); @@ -97,13 +94,12 @@ int uv_timer_again(uv_timer_t* handle) { } -void uv_timer_set_repeat(uv_timer_t* handle, int64_t repeat) { - assert(repeat >= 0); +void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) { handle->repeat = repeat; } -int64_t uv_timer_get_repeat(uv_timer_t* handle) { +uint64_t uv_timer_get_repeat(uv_timer_t* handle) { return handle->repeat; } diff --git a/src/win/timer.c b/src/win/timer.c index 3364f6c0..60991295 100644 --- a/src/win/timer.c +++ b/src/win/timer.c @@ -87,8 +87,8 @@ void uv_timer_endgame(uv_loop_t* loop, uv_timer_t* handle) { } -int uv_timer_start(uv_timer_t* handle, uv_timer_cb timer_cb, int64_t timeout, - int64_t repeat) { +int uv_timer_start(uv_timer_t* handle, uv_timer_cb timer_cb, uint64_t timeout, + uint64_t repeat) { uv_loop_t* loop = handle->loop; uv_timer_t* old; @@ -157,13 +157,13 @@ int uv_timer_again(uv_timer_t* handle) { } -void uv_timer_set_repeat(uv_timer_t* handle, int64_t repeat) { +void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) { assert(handle->type == UV_TIMER); handle->repeat = repeat; } -int64_t uv_timer_get_repeat(uv_timer_t* handle) { +uint64_t uv_timer_get_repeat(uv_timer_t* handle) { assert(handle->type == UV_TIMER); return handle->repeat; }