diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 23ca5d3dd..1170cd9d5 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -452,6 +452,24 @@ unsigned int sleep (unsigned int seconds) | |||
452 | return 0; | 452 | return 0; |
453 | } | 453 | } |
454 | 454 | ||
455 | int nanosleep(const struct timespec *req, struct timespec *rem) | ||
456 | { | ||
457 | if (req->tv_nsec < 0 || 1000000000 <= req->tv_nsec) { | ||
458 | errno = EINVAL; | ||
459 | return -1; | ||
460 | } | ||
461 | |||
462 | Sleep(req->tv_sec*1000 + req->tv_nsec/1000000); | ||
463 | |||
464 | /* Sleep is not interruptible. So there is no remaining delay. */ | ||
465 | if (rem != NULL) { | ||
466 | rem->tv_sec = 0; | ||
467 | rem->tv_nsec = 0; | ||
468 | } | ||
469 | |||
470 | return 0; | ||
471 | } | ||
472 | |||
455 | /* | 473 | /* |
456 | * Windows' mktemp returns NULL on error whereas POSIX always returns the | 474 | * Windows' mktemp returns NULL on error whereas POSIX always returns the |
457 | * template and signals an error by making it an empty string. | 475 | * template and signals an error by making it an empty string. |