summaryrefslogtreecommitdiff
path: root/libc/unistd/sleep.c
blob: b6c410fb5690e7a7cf4813bfc333dcbed825f3c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24


#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>

int usleep (__useconds_t usec)
{
	struct timeval tv;

	tv.tv_sec = usec / 1000000;
	tv.tv_usec = usec % 1000000;
	return(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;
}