sleep.c 320 B

1234567891011121314151617181920
  1. #if defined(_WIN32)
  2. #include <windows.h>
  3. #else
  4. #include <unistd.h>
  5. #endif
  6. /* sleeps for n seconds, where n is the argument to the program */
  7. int main(int argc, char** argv)
  8. {
  9. int time;
  10. if (argc > 1) {
  11. time = atoi(argv[1]);
  12. }
  13. #if defined(_WIN32)
  14. Sleep(time * 1000);
  15. #else
  16. sleep(time);
  17. #endif
  18. return 0;
  19. }