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

Fred Rothganger fred
Mon Oct 15 15:51:08 CEST 2007


Alexander Chemeris wrote:
> 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.
>
>   

Ok, I'll look into some of the other options and send another patch.

-- Fred




More information about the ffmpeg-devel mailing list