summaryrefslogtreecommitdiff
path: root/libc/unistd/usleep.c
blob: db8b8710c8d09b0a19bf2e970f532ae715349cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#define nanosleep __nanosleep

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

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));
}