blob: 2b63a9ed8bfe6dd5aa485f5856d46de229758809 (
plain)
1
2
3
4
5
6
7
8
9
10
|
#include <time.h> // for nanosleep, timespec
#include <unistd.h> // for sleep
unsigned sleep(unsigned seconds)
{
struct timespec tv = { .tv_sec = seconds, .tv_nsec = 0 };
if (nanosleep(&tv, &tv))
return tv.tv_sec;
return 0;
}
|