]> icculus.org git repositories - btb/d2x.git/blob - arch/sdl/timer.c
changed path for SDL headers
[btb/d2x.git] / arch / sdl / timer.c
1 /* $Id: timer.c,v 1.5 2003-01-15 02:42:41 btb Exp $ */
2 /*
3  *
4  * SDL library timer functions
5  *
6  *
7  */
8
9 #ifdef HAVE_CONFIG_H
10 #include <conf.h>
11 #endif
12
13 #include <SDL.h>
14
15 #include "maths.h"
16 #include "timer.h"
17
18 fix timer_get_fixed_seconds(void) {
19 #if 1
20         return approx_msec_to_fsec(SDL_GetTicks());
21 #else
22   fix x;
23   unsigned long tv_now = SDL_GetTicks();
24   x=i2f(tv_now/1000) | fixdiv(i2f(tv_now % 1000),i2f(1000));
25   return x;
26 #endif
27 }
28
29 void timer_delay(fix seconds)
30 {
31 #if 1
32         SDL_Delay(approx_fsec_to_msec(seconds));
33 #else
34         SDL_Delay(f2i(fixmul(seconds, i2f(1000))));
35 #endif
36 }