sleep.c 327 B

123456789101112131415161718192021
  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. {
  12. time = atoi(argv[1]);
  13. }
  14. #if defined(_WIN32)
  15. Sleep(time * 1000);
  16. #else
  17. sleep(time);
  18. #endif
  19. return 0;
  20. }