summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/usleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/usleep.c')
-rw-r--r--sysdeps/unix/sysv/linux/usleep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/usleep.c b/sysdeps/unix/sysv/linux/usleep.c
index 9d36a90008..9265897053 100644
--- a/sysdeps/unix/sysv/linux/usleep.c
+++ b/sysdeps/unix/sysv/linux/usleep.c
@@ -1,5 +1,5 @@
/* Implementation of the BSD usleep function using nanosleep.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -24,8 +24,8 @@
void
usleep (unsigned int useconds)
{
- struct timespec ts = { tv_sec: 0,
- tv_nsec: (long int) useconds * 1000ul };
+ struct timespec ts = { tv_sec: (long int) (useconds / 1000000),
+ tv_nsec: (long int) (useconds % 1000000) * 1000ul };
__nanosleep (&ts, NULL);
}