Mercurial > mplayer.hg
comparison osdep/timer-win2.c @ 9983:14c92818ab75
alternative timer and glob emulation code for mingw32 port
author | faust3 |
---|---|
date | Fri, 25 Apr 2003 10:00:18 +0000 |
parents | |
children | 1d5205bab61a |
comparison
equal
deleted
inserted
replaced
9982:cd76f332bdee | 9983:14c92818ab75 |
---|---|
1 // Precise timer routines for WINDOWS | |
2 | |
3 #include <windows.h> | |
4 #include <mmsystem.h> | |
5 #include "timer.h" | |
6 | |
7 // Returns current time in microseconds | |
8 unsigned int GetTimer(){ | |
9 return timeGetTime() * 1000; | |
10 } | |
11 | |
12 // Returns current time in milliseconds | |
13 unsigned int GetTimerMS(){ | |
14 return timeGetTime() ; | |
15 } | |
16 | |
17 int usec_sleep(int usec_delay){ | |
18 Sleep( usec_delay/1000); | |
19 return 0; | |
20 } | |
21 | |
22 static DWORD RelativeTime = 0; | |
23 | |
24 float GetRelativeTime(){ | |
25 DWORD t, r; | |
26 t = GetTimer(); | |
27 r = t - RelativeTime; | |
28 RelativeTime = t; | |
29 return (float) r *0.000001F; | |
30 } | |
31 | |
32 void InitTimer(){ | |
33 GetRelativeTime(); | |
34 } |