musl-tcc/src/unistd/sleep.c
2022-03-20 16:48:53 +08:00

11 lines
192 B
C

#include <unistd.h>
#include <time.h>
unsigned sleep(unsigned seconds)
{
struct timespec tv = { .tv_sec = seconds, .tv_nsec = 0 };
if (nanosleep(&tv, &tv))
return tv.tv_sec;
return 0;
}