diff options
Diffstat (limited to 'osdep/timer-win2.c')
-rw-r--r-- | osdep/timer-win2.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/osdep/timer-win2.c b/osdep/timer-win2.c index 88a047410d..99980d76bc 100644 --- a/osdep/timer-win2.c +++ b/osdep/timer-win2.c @@ -22,27 +22,25 @@ #include <mmsystem.h> #include "timer.h" -// Returns current time in microseconds -unsigned int GetTimer(void) +void mp_sleep_us(int64_t us) { - return timeGetTime() * 1000; + if (us < 0) + return; + // Sleep(0) won't sleep for one clocktick as the unix usleep + // instead it will only make the thread ready + // it may take some time until it actually starts to run again + if (us < 1000) + us = 1000; + Sleep(us / 1000); } -// Returns current time in milliseconds -unsigned int GetTimerMS(void) +uint64_t mp_raw_time_us(void) { - return timeGetTime() ; + return timeGetTime() * 1000; } -int usec_sleep(int usec_delay){ - // Sleep(0) won't sleep for one clocktick as the unix usleep - // instead it will only make the thread ready - // it may take some time until it actually starts to run again - if(usec_delay<1000)usec_delay=1000; - Sleep( usec_delay/1000); - return 0; -} - -void InitTimer(void) +void mp_raw_time_init(void) { + // request 1ms timer resolution + timeBeginPeriod(1); } |