QueryPerformanceFrequency can be different



  • I see QueryPerformanceFrequency was called only once in qelapsedtimer_win.cpp. In China running LuDaShi or some other software, QueryPerformanceFrequency has to be called every time because CPU clock speeds can be different!
    Once my recorder programme using QElapsedTimer::elapsed() was 5 times slow than the real world time, so it's 5 times faster when i play it back.



  • Hi @JinZeyu, and welcome! :)

    I see QueryPerformanceFrequency was called only once in qelapsedtimer_win.cpp. ... QueryPerformanceFrequency has to be called every time because CPU clock speeds can be different!

    First up, that's a pretty advanced internal question, which might be better asked on the Qt dev mailing list.

    Having said that, (and I know nothing about this topic), the MSDN docs appear to disagree with you (emphasis mine):

    QueryPerformanceFrequency function

    Retrieves the frequency of the performance counter. The frequency of the performance counter is fixed at system boot and is consistent across all processors. Therefore, the frequency need only be queried upon application initialization, and the result can be cached.

    Cheers.



  • @Paul-Colby thanks for your reply!
    I'm not sure why this happen, maybe something wrong at elsewhere. I can check it out ,em...(work work...)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.