From 174dc1b8cd932fb5cd3d50fe5317e0c29ee26c59 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 11 Oct 2000 22:51:00 +0000 Subject: Reorg unistd dir --- libc/unistd/sleep.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 libc/unistd/sleep.c (limited to 'libc/unistd/sleep.c') 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 +#include +#include + +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; +} -- cgit v1.2.3