Add a comment that explains why this header has no multiple inclusion guards.
[mplayer/greg.git] / osdep / timer-win2.c
blob2f0b5c3075b49528f9bb46645ea0c1e5a6eda423
1 // Precise timer routines for WINDOWS
3 #include <windows.h>
4 #include <mmsystem.h>
5 #include "timer.h"
7 const char *timer_name = "Windows native";
9 // Returns current time in microseconds
10 unsigned int GetTimer(){
11 return timeGetTime() * 1000;
14 // Returns current time in milliseconds
15 unsigned int GetTimerMS(){
16 return timeGetTime() ;
19 int usec_sleep(int usec_delay){
20 // Sleep(0) won't sleep for one clocktick as the unix usleep
21 // instead it will only make the thread ready
22 // it may take some time until it actually starts to run again
23 if(usec_delay<1000)usec_delay=1000;
24 Sleep( usec_delay/1000);
25 return 0;
28 static DWORD RelativeTime = 0;
30 float GetRelativeTime(){
31 DWORD t, r;
32 t = GetTimer();
33 r = t - RelativeTime;
34 RelativeTime = t;
35 return (float) r *0.000001F;
38 void InitTimer(){
39 GetRelativeTime();