]> git.sur5r.net Git - cc65/blob - libsrc/common/sleep.c
Fix 32/64-bit int/pointer casts
[cc65] / libsrc / common / sleep.c
1 /*
2 ** sleep.c
3 **
4 ** Stefan Haubenthal, 2003-06-11
5 ** Ullrich von Bassewitz, 2003-06-12
6 **
7 */
8
9
10
11 #include <time.h>
12 #include <unistd.h>
13
14
15
16 /* We cannot implement this function without a working clock function */
17 #if defined(CLOCKS_PER_SEC)
18 unsigned __fastcall__ sleep (unsigned wait)
19 {
20     clock_t goal = clock () + ((clock_t) wait) * CLOCKS_PER_SEC;
21     while ((long) (goal - clock ()) > 0) ;
22     return 0;
23 }
24 #endif
25
26
27