diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-10-11 22:51:00 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-10-11 22:51:00 +0000 |
commit | 174dc1b8cd932fb5cd3d50fe5317e0c29ee26c59 (patch) | |
tree | 7683117cfc44f8f09610b5f1f48bcdb1524031bb /libc/unistd/sleep.c | |
parent | 1eb3e9989a8241c1654788fc7589e1f679e73dff (diff) |
Reorg unistd dir
Diffstat (limited to 'libc/unistd/sleep.c')
-rw-r--r-- | libc/unistd/sleep.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c new file mode 100644 index 000000000..5b458e07a --- /dev/null +++ b/libc/unistd/sleep.c @@ -0,0 +1,24 @@ + + +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> + +void usleep(unsigned long usec) +{ + struct timeval tv; + + tv.tv_sec = usec / 1000000; + tv.tv_usec = usec % 1000000; + select(0, 0, 0, 0, &tv); +} + +unsigned int sleep(unsigned int sec) +{ + struct timeval tv; + + tv.tv_sec = sec; + tv.tv_usec = 0; + select(0, 0, 0, 0, &tv); + return tv.tv_sec; +} |