diff --git a/src/unix/core.c b/src/unix/core.c index 2d5479af..6b10af56 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -1557,13 +1557,9 @@ int uv_gettimeofday(uv_timeval64_t* tv) { } void uv_sleep(unsigned int msec) { - unsigned int sec; - unsigned int usec; + struct timespec timeout; - sec = msec / 1000; - usec = (msec % 1000) * 1000; - if (sec > 0) - sleep(sec); - if (usec > 0) - usleep(usec); + timeout.tv_sec = msec / 1000; + timeout.tv_nsec = (msec % 1000) * 1000 * 1000; + nanosleep(&timeout, NULL); }