diff options
Diffstat (limited to 'libc/unistd/usleep.c')
| -rw-r--r-- | libc/unistd/usleep.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libc/unistd/usleep.c b/libc/unistd/usleep.c index 8a27f900a..8d01703ec 100644 --- a/libc/unistd/usleep.c +++ b/libc/unistd/usleep.c @@ -11,24 +11,22 @@ #if defined __USE_BSD || defined __USE_POSIX98 #if defined __UCLIBC_HAS_REALTIME__ -/*libc_hidden_proto(nanosleep) need the reloc for cancellation*/ int usleep (__useconds_t usec) { - const struct timespec ts = { - .tv_sec = (long int) (usec / 1000000), - .tv_nsec = (long int) (usec % 1000000) * 1000ul - }; - return(nanosleep(&ts, NULL)); + const struct timespec ts = { + .tv_sec = (long int) (usec / 1000000), + .tv_nsec = (long int) (usec % 1000000) * 1000ul + }; + return nanosleep(&ts, NULL); } #else /* __UCLIBC_HAS_REALTIME__ */ -libc_hidden_proto(select) int usleep (__useconds_t usec) { struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = usec; + tv.tv_sec = (long int) (usec / 1000000); + tv.tv_usec = (long int) (usec % 1000000); return select(0, NULL, NULL, NULL, &tv); } #endif /* __UCLIBC_HAS_REALTIME__ */ |
