-
Notifications
You must be signed in to change notification settings - Fork 2
/
fbsd_timer.c
120 lines (100 loc) · 1.77 KB
/
fbsd_timer.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#include <sys/fbio.h>
#include <sys/consio.h>
#include <vgl.h>
#include "def.h"
extern Uint5 ftime;
long int account = 0;
long int slept = 0;
int i = 0;
struct timeval *prev = NULL;
void inittimer(void)
{
FIXME("inittimer called");
}
Sint5 getlrt(void)
{
FIXME("getlrt called");
return(0);
}
Uint5 gethrt(void)
{
long int diff;
int was_error;
struct timeval curr;
struct timespec timer, elapsed;
VGLCheckSwitch();
/* Speed controlling stuff */
if (prev == NULL) {
prev = malloc(sizeof (struct timeval));
gettimeofday(prev, NULL);
} else {
gettimeofday(&curr, NULL);
diff = (ftime - (curr.tv_sec - prev->tv_sec)*1000000 - (curr.tv_usec - prev->tv_usec)) * 1000;
if (diff > 0) {
timer.tv_sec = 0;
timer.tv_nsec = diff;
do {
errno = 0;
was_error = nanosleep(&timer, &elapsed);
timer.tv_sec -= elapsed.tv_sec;
timer.tv_nsec -= elapsed.tv_nsec;
} while( was_error && (errno == EINTR) );
}
gettimeofday(&curr, NULL);
memcpy(prev, &curr, (sizeof (struct timeval)));
}
return(0);
}
Sint5 getkips(void)
{
FIXME("getkips called");
return(0);
}
void s0initint8(void)
{
FIXME("s0initint8 called");
}
void s0restoreint8(void)
{
FIXME("s0restoreint8 called");
}
void s1initint8(void)
{
FIXME("s1initint8 called");
}
void s1restoreint8(void)
{
FIXME("s1restoreint8 called");
}
void s0soundoff(void)
{
FIXME("s0soundoff called");
}
void s0setspkrt2(void)
{
FIXME("s0setspkrt2 called");
}
void s0settimer0(Sint4 t0v)
{
FIXME("s0settimer0 called");
}
void s0settimer2(Sint4 t0v)
{
FIXME("s0settimer2 called");
}
void s0timer0(Sint4 t0v)
{
FIXME("s0timer0 called");
}
void s0timer2(Sint4 t0v)
{
FIXME("s0timer2 called");
}
void s0soundkillglob(void)
{
/* No-op */
}