[MPlayer-dev-eng] [PATCH] get_time

Dan Oscarsson Dan.Oscarsson at tieto.com
Thu Sep 16 18:31:09 CEST 2010


ons 2010-09-15 klockan 19:24 +0200 skrev Reimar Döffinger:
> On Sun, Sep 12, 2010 at 01:58:24PM +0200, Dan Oscarsson wrote:
> > --- osdep/timer-win2.c.org	2010-09-10 14:26:20.011294728 +0200
> > +++ osdep/timer-win2.c	2010-09-10 14:26:38.782419722 +0200
> > @@ -24,6 +24,12 @@
> >  
> >  const char timer_name[] = "Windows native";
> >  
> > +// Returns current time in microseconds in 64 bit quantity so it does not wrap
> > +uint64_t get_time(void)
> > +{
> > +  return timeGetTime() * 1000;
> > +}
> > +
> 
> Ok, since all my attempts to explain the problem in an abstract form
> obviously didn't work let me be specific:
> This will wrap around within 50 days.
> How will your new code that relies on this new get_time function
> handle that?

You are right, I had not looked very much at the MS Windows code, and
the timeGetTime has bad resolution (5-10 ms).

I had a quick look at vlc and they have code that handles all the
problems, including using monotonic clock, if available, on Linux/Unix,
and high precision clock on Ms Windows, if possible, and handling the 50
day wrap if having to fall back on timeGetTime.

So by looking at that we could enhance both linux and ms windows timers
in mplayer.

   Dan



More information about the MPlayer-dev-eng mailing list