sleep.c 192 B

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