diff options
author | wm4 <wm4@nowhere> | 2013-05-25 17:12:03 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-26 16:44:20 +0200 |
commit | 561aab2d770776fcc60a03f3aca20782572b9a36 (patch) | |
tree | 9249f5283b63fef77f7477b5e3b122f838e741d1 | |
parent | 81439c5f35e604174408a2aaf4e4dec11b81ac39 (diff) | |
download | mpv-561aab2d770776fcc60a03f3aca20782572b9a36.tar.bz2 mpv-561aab2d770776fcc60a03f3aca20782572b9a36.tar.xz |
timer: use gettimeofday() on Windows
MinGW-w64 emulates this via GetSystemTimeAsFileTime(), which has
supposedly the best and most stable timer source out of most others.
http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-crt/misc/gettimeofday.c
-rw-r--r-- | osdep/timer-win2.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/osdep/timer-win2.c b/osdep/timer-win2.c index 99980d76bc..136bb0becc 100644 --- a/osdep/timer-win2.c +++ b/osdep/timer-win2.c @@ -19,6 +19,7 @@ */ #include <windows.h> +#include <sys/time.h> #include <mmsystem.h> #include "timer.h" @@ -36,7 +37,9 @@ void mp_sleep_us(int64_t us) uint64_t mp_raw_time_us(void) { - return timeGetTime() * 1000; + struct timeval tv; + gettimeofday(&tv,NULL); + return tv.tv_sec * 1000000LL + tv.tv_usec; } void mp_raw_time_init(void) |