about summary refs log tree commit diff
path: root/lib/util/nsleep.c
blob: 943b8c7764d6c29556592085a5b6cf0c4dfae810 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifdef WIN32
  #include <windows.h>
  #include <process.h>
#else
  #include <unistd.h>
#endif

#include "nsleep.h"



void
sleepN(unsigned int const milliseconds) {

#ifdef WIN32
    SleepEx(milliseconds, TRUE);
#else

    /* We could use usleep() here if millisecond resolution is really
       important, but since Netpbm has no need for it today, we don't
       want to deal with the possibility that usleep() doesn't exist.
       08.08.01.
    */

    sleep((milliseconds + 999)/1000);
#endif
}