]> icculus.org git repositories - btb/d2x.git/blob - arch/sdl/timer.c
fix off by .5 errors in ogl_upixelc and ogl_ulinec (d1x r1.29)
[btb/d2x.git] / arch / sdl / timer.c
1 /* $Id: timer.c,v 1.6 2003-02-21 04:08:48 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_approx_seconds(void)
19 {
20         return approx_msec_to_fsec(SDL_GetTicks());
21 }
22
23 fix timer_get_fixed_seconds(void)
24 {
25         fix x;
26         unsigned long tv_now = SDL_GetTicks();
27         x=i2f(tv_now/1000) | fixdiv(i2f(tv_now % 1000),i2f(1000));
28         return x;
29 }
30
31 void timer_delay(fix seconds)
32 {
33         SDL_Delay(f2i(fixmul(seconds, i2f(1000))));
34 }