eqemu

view src/timer.cc @ 2:48dce4ee4850

the fake device is working
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 15 Jul 2014 14:37:51 +0300
parents
children e9ab4861536d
line source
1 #include <unistd.h>
2 #include <sys/time.h>
4 unsigned long get_msec()
5 {
6 static struct timeval tv0;
7 struct timeval tv;
9 gettimeofday(&tv, 0);
10 if(tv0.tv_sec == 0 && tv0.tv_usec == 0) {
11 tv0 = tv;
12 return 0;
13 }
14 return (tv.tv_sec - tv0.tv_sec) * 1000 + (tv.tv_usec - tv0.tv_usec) / 1000;
15 }