about summary refs log tree commit diff
path: root/lib/util/nsleep.c
blob: 24d48207711b3606fa6a8cfb3d3c25293f1bc087 (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
28
29
#include "pm_config.h"

#if MSVCRT
  #include <windows.h>
  #include <process.h>
#else
  #include <unistd.h>
#endif

#include "nsleep.h"



void
pm_sleep(unsigned int const milliseconds) {

#if MSVCRT
    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
}