sleep.c 324 Bytes
Newer Older
Zach's avatar
Zach committed
1
#if defined(_WIN32)
2
#  include <windows.h>
Zach's avatar
Zach committed
3
#else
4
#  include <unistd.h>
Zach's avatar
Zach committed
5 6 7 8 9 10
#endif

/* sleeps for n seconds, where n is the argument to the program */
int main(int argc, char** argv)
{
  int time;
11
  if (argc > 1) {
Zach's avatar
Zach committed
12
    time = atoi(argv[1]);
13
  }
Zach's avatar
Zach committed
14 15 16 17 18 19 20
#if defined(_WIN32)
  Sleep(time * 1000);
#else
  sleep(time);
#endif
  return 0;
}