sleep.c 254 B

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