summaryrefslogtreecommitdiffstats
path: root/osdep/timer-win2.c
diff options
context:
space:
mode:
authorfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-25 10:00:18 +0000
committerfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-25 10:00:18 +0000
commit0015a97826319e469e1614932749ab315f28f0fb (patch)
treefa380ac0d15245da7e539c2b41aee5fcc76f4d16 /osdep/timer-win2.c
parent472539ae252638f18f38628adb059cfd53958e2a (diff)
downloadmpv-0015a97826319e469e1614932749ab315f28f0fb.tar.bz2
mpv-0015a97826319e469e1614932749ab315f28f0fb.tar.xz
alternative timer and glob emulation code for mingw32 port
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9984 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'osdep/timer-win2.c')
-rw-r--r--osdep/timer-win2.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/osdep/timer-win2.c b/osdep/timer-win2.c
new file mode 100644
index 0000000000..eb8bb3d3f4
--- /dev/null
+++ b/osdep/timer-win2.c
@@ -0,0 +1,34 @@
+// Precise timer routines for WINDOWS
+
+#include <windows.h>
+#include <mmsystem.h>
+#include "timer.h"
+
+// Returns current time in microseconds
+unsigned int GetTimer(){
+ return timeGetTime() * 1000;
+}
+
+// Returns current time in milliseconds
+unsigned int GetTimerMS(){
+ return timeGetTime() ;
+}
+
+int usec_sleep(int usec_delay){
+ Sleep( usec_delay/1000);
+ return 0;
+}
+
+static DWORD RelativeTime = 0;
+
+float GetRelativeTime(){
+ DWORD t, r;
+ t = GetTimer();
+ r = t - RelativeTime;
+ RelativeTime = t;
+ return (float) r *0.000001F;
+}
+
+void InitTimer(){
+ GetRelativeTime();
+}