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