diff options
author | wm4 <wm4@nowhere> | 2013-05-17 19:54:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-26 16:44:20 +0200 |
commit | 81439c5f35e604174408a2aaf4e4dec11b81ac39 (patch) | |
tree | abd67642f487850c7f16666cc5f456d8f7ca347f /core/mplayer.c | |
parent | 25d66f526ebae36a6c044652e5006450dd5a30df (diff) | |
download | mpv-81439c5f35e604174408a2aaf4e4dec11b81ac39.tar.bz2 mpv-81439c5f35e604174408a2aaf4e4dec11b81ac39.tar.xz |
timer: refactor, add 64 bit timer function
Make OS specific timer code export a mp_raw_time_us() function, and
add generic implementations of GetTimer()/GetTimerMS() using this
function. New mpv code is supposed to call mp_time_us() in situations
where precision is absolutely needed, or mp_time_s() otherwise.
Make it so that mp_time_us() will return a value near program start.
We don't set it to 0 though to avoid confusion with relative vs.
absolute time. Instead, pick an arbitrary offset.
Move the test program in timer-darwin.c to timer.c, and modify it to
work with the generic timer functions.
Diffstat (limited to 'core/mplayer.c')
-rw-r--r-- | core/mplayer.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/core/mplayer.c b/core/mplayer.c index 5036d1e476..df6b42973e 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -4722,19 +4722,16 @@ static void osdep_preinit(int *p_argc, char ***p_argv) atexit(detach_ptw32); #endif - InitTimer(); - srand(GetTimerMS()); - #if defined(__MINGW32__) || defined(__CYGWIN__) // stop Windows from showing all kinds of annoying error dialogs SetErrorMode(0x8003); - // request 1ms timer resolution - timeBeginPeriod(1); #endif #ifdef HAVE_TERMCAP load_termcap(NULL); // load key-codes #endif + + mp_time_init(); } /* This preprocessor directive is a hack to generate a mplayer-nomain.o object |