diff options
Diffstat (limited to 'lib/util/nsleep.c')
-rw-r--r-- | lib/util/nsleep.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/util/nsleep.c b/lib/util/nsleep.c new file mode 100644 index 00000000..6e61b3be --- /dev/null +++ b/lib/util/nsleep.c @@ -0,0 +1,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 +} |