This commit was manufactured by cvs2svn to create tag 'd2x-0_1_2'.
[btb/d2x.git] / misc / d_delay.c
1 //added on 9/2/98 by Matt Mueller
2
3 #ifdef HAVE_CONFIG_H
4 #include <conf.h>
5 #endif
6
7 #include "d_delay.h"
8
9 #ifndef d_delay
10
11 #if defined(__WINDOWS__) || defined(__MINGW32__)
12
13 #include <windows.h>
14
15 void d_delay (int ms) {
16  Sleep(ms);
17 }
18
19 #else
20
21 #include <sys/time.h>
22 #include <sys/types.h>
23 #include <unistd.h>
24 #include <time.h>
25
26 void d_delay (int ms) {
27 #if 0
28         struct timeval tv;
29         tv.tv_sec=ms/1000;
30 //edited 02/06/99 Matt Mueller - microseconds, not milliseconds
31         tv.tv_usec=(ms%1000)*1000;
32 //end edit -MM
33         select(0,NULL,NULL,NULL,&tv);
34 #elif 0
35         struct timespec tv;
36         tv.tv_sec=ms/1000;
37         tv.tv_nsec=(ms%1000)*1000000;//nanoseconds
38         nanosleep(&tv,NULL);
39 #else
40         usleep(ms*1000);
41 #endif
42 }
43
44 #endif
45 #endif