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