sleep.c 285 B

123456789101112131415
  1. #include <time.h>
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. int main(void) {
  6. sleep(2);
  7. perror("sleep");
  8. usleep(1000);
  9. perror("usleep");
  10. struct timespec tm = {0, 10000};
  11. nanosleep(&tm, NULL);
  12. perror("nanosleep");
  13. return EXIT_SUCCESS;
  14. }