-
Notifications
You must be signed in to change notification settings - Fork 1
/
unix2nt.c
70 lines (61 loc) · 1.32 KB
/
unix2nt.c
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "c_includ.h"
#ifdef WIN31
#include <toolhelp.h>
#endif
HPEN hpen[MAX_COLORS];
HBRUSH hbrushBlack;
HBRUSH hbrushFill;
VKEY vkey[] = { VK_LBUTTON, 0, 'a', 'A',
'Q', 0, 'Q', 'Q',
VK_RBUTTON, 0, 'c', 'C' };
// Stub out c_score.c by Eric Fogelin
LONG scores( LONG score)
{
return 0;
}
/*
*/
// Implement gettimeofday by Eric Fogelin
void gettimeofday( struct timeval *unixtime, int dummy )
{
#ifdef WIN32
unsigned int millisecs;
millisecs = GetTickCount();
unixtime->tv_sec = millisecs / 1000; // seconds
unixtime->tv_usec = (millisecs % 1000) * 1000; // micro seconds
#else
time_t secs;
unixtime->tv_sec = secs;
unixtime->tv_usec = 0;
#endif
}
/*
*/
#ifdef WIN31
void Sleep( DWORD msec )
{
DWORD endtime;
// TIMERINFO ti;
BOOL done;
// TimerCount( &ti );
endtime = GetTickCount() + msec;
do {
done = ( GetTickCount() >= endtime);
// TimerCount( &ti );
// done = ( ti.dwmsSinceStart >= endtime);
} while (!done);
}
/*
*/
#endif //WIN31
// Implement select by Eric Fogelin
// select appears to be used as a fine grain delay (microseconds)
void select( int dummy1, int dummy2, int dummy3, int dummy4, struct timeval *unixtime )
{
#ifdef WIN32
// Convert from micro to milliseconds
Sleep( unixtime->tv_sec * 1000 + unixtime->tv_usec/1000 );
#endif
}
/*
*/