From 81439c5f35e604174408a2aaf4e4dec11b81ac39 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 17 May 2013 19:54:37 +0200 Subject: 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. --- core/mplayer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'core/mplayer.c') 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 -- cgit v1.2.3