1 |
|
/* |
2 |
|
* C64_x.h - Put the pieces together, X specific stuff |
3 |
|
* |
4 |
< |
* Frodo (C) 1994-1997,2002-2003 Christian Bauer |
4 |
> |
* Frodo (C) 1994-1997,2002-2005 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
95 |
|
} |
96 |
|
#endif |
97 |
|
|
98 |
+ |
#ifdef __linux__ |
99 |
+ |
// select() timing is much more accurate under Linux |
100 |
+ |
static void Delay_usec(unsigned long usec) |
101 |
+ |
{ |
102 |
+ |
int was_error; |
103 |
+ |
struct timeval tv; |
104 |
+ |
|
105 |
+ |
tv.tv_sec = 0; |
106 |
+ |
tv.tv_usec = usec; |
107 |
+ |
do { |
108 |
+ |
errno = 0; |
109 |
+ |
was_error = select(0, NULL, NULL, NULL, &tv); |
110 |
+ |
} while (was_error && (errno == EINTR)); |
111 |
+ |
} |
112 |
+ |
#else |
113 |
+ |
static void Delay_usec(unsigned long usec) |
114 |
+ |
{ |
115 |
+ |
usleep(usec); |
116 |
+ |
} |
117 |
+ |
#endif |
118 |
+ |
|
119 |
|
|
120 |
|
/* |
121 |
|
* Constructor, system-dependent things |
268 |
|
|
269 |
|
// Limit speed to 100% if desired |
270 |
|
if ((speed_index > 100) && ThePrefs.LimitSpeed) { |
271 |
< |
usleep((unsigned long)(ThePrefs.SkipFrames * 20000 - elapsed_time)); |
271 |
> |
Delay_usec((unsigned long)(ThePrefs.SkipFrames * 20000 - elapsed_time)); |
272 |
|
speed_index = 100; |
273 |
|
} |
274 |
|
|