]> icculus.org git repositories - btb/d2x.git/blob - arch/linux/timer.c
changed cdrom->rbaudio
[btb/d2x.git] / arch / linux / timer.c
1 #include <conf.h>
2 #include <sys/time.h>
3 #include <stdio.h>
4 #include "maths.h"
5
6 static struct timeval tv_old;
7
8 fix timer_get_fixed_seconds(void)
9 {
10         fix x;
11         struct timeval tv_now;
12         gettimeofday(&tv_now, NULL);
13         x=i2f(tv_now.tv_sec - tv_old.tv_sec) + fixdiv(i2f((tv_now.tv_usec - tv_old.tv_usec)/1000), i2f(1000));
14         return x;
15 }
16
17 void timer_init(void)
18 {
19         gettimeofday(&tv_old, NULL);
20 }