locked
CreateTimerQueueTimer (or timeSetEvent) precision with W10 RRS feed

  • Question

  • Hi

    Under W10, the wake up delay time after calling CreateTimerQueueTimer with a delay of 3ms (e.g.) is not precise at all (using either a periodic delay or a repetitive single delay). The wake up delay time is sometimes 3ms, sometimes less (can be less than 2.1ms !) but is very very very often between 3.4ms to 4ms.

    I observe this on several PC under w10 (32 or 64bits)

    The accuracy of the same software running under W7 pro (32 or 64bits) is less than 0.2ms. This qualitative result is based on dozens PC installed in industrial machines (cutting, bending, polishing....)

    So my question is, how can I obtain the same timer accuracy under W10 than under Seven ?

    notes:

      a) I wait the anniversary update of W10 but nothing change for my problem and the support of W7 is quite finish !

      b) using timeSetEvent instead of CreateTimerQueueTimer increase the accuracy under W7 but do nothing better under W10

    Tuesday, November 1, 2016 4:29 PM

All replies

  • Hi,

    CreateTimerQueue is not meant for precise timing. It uses thread-pools underneath, which may introduce significant delays.

    From my survey, the accuracy of timers and the real time clock in Windows is limited by the clock tick interrupt rate. Which by default tocks 64 times per second, 1/64 sec = 15.625 msec. as you mentioned.

    Increasing that rate is actually possible, call timeBeginPeriod(10) at the start of your program to get 10 msec accuracy.

    https://msdn.microsoft.com/en-us/library/dd757624(VS.85).aspx

    You can also feedback this condition to Microsoft by built-in Feedback Hub app, maybe a high resolution timer will be released in future.

    Regards


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, November 2, 2016 2:39 AM
  • Starting with Windows 10 Version 2004, increasing the rate using timeBeginPeriod() doesn't work.
    It is broken. At least for CreateTimerQueueTimer () and SetThreadpoolTimer()
    Monday, June 22, 2020 7:55 PM
  • I confirm our software which relies on

    timeBeginPeriod(1)

    for 125hz callback frequency no longer works with Windows 10 2004 update.  At most the frequency is about 64Hz

    Does Microsoft know about this issue ?

    Tuesday, June 30, 2020 1:51 PM
  • I log the issue into Feedback Hub https://aka.ms/AA8r0y7

    But I get no feedback :-(

    Tuesday, June 30, 2020 2:11 PM
  • We also rely on timeBeginPeriod(1) and noticed the same problem in 2004.  However we think it is fixed in Visual Studio 2019. 
    Thursday, July 9, 2020 12:12 AM
  • No it is not fixed in Visual Studio 2019. It is not related to the compiler.

    Thursday, July 9, 2020 1:32 PM
  • Due to security and privacy policies, forum no longer collect/analyze users’ log and dump files. For deep research on the , I advise open a support ticket with Microsoft. There are best resources can help you.


    Please mark the reply as an answer if you find it is helpful.

    Friday, July 31, 2020 7:41 AM