[FFmpeg-devel] [PATCH] Use hi-res timer under win32 builds

Alexander Chemeris ipse.ffmpeg
Mon Oct 15 11:57:27 CEST 2007


On 10/15/07, Fred Rothganger <fred at rothganger.org> wrote:
> @@ -2579,9 +2583,21 @@
>   */
>  int64_t av_gettime(void)
>  {
> +#   if defined(WIN32) || defined(__CYGWIN__)
> +
> +    LARGE_INTEGER count;
> +    LARGE_INTEGER frequency;
> +    QueryPerformanceCounter (&count);
> +    QueryPerformanceFrequency (&frequency);
> +    return count.QuadPart * 1000000 / frequency.QuadPart;
> +
> +#   else
> +
>      struct timeval tv;
>      gettimeofday(&tv,NULL);
>      return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
> +
> +#   endif
>  }

DON'T USE THIS if you do not actually understand how to get this
working relibaly. A good reasoning is provided here:
http://www.virtualdub.org/blog/pivot/entry.php?id=106
Also there was some technical note from MS about this issues,
but I do not recall url for it. I saw QueryPerformanceCounter()
badness myself on my Core2 Duo - it provided totally different
values being called on different cores.

-- 
Regards,
Alexander Chemeris.

SIPez LLC.
SIP VoIP, IM and Presence Consulting
http://www.SIPez.com
tel: +1 (617) 273-4000




More information about the ffmpeg-devel mailing list