How can I use CreateTimerQueueTimer to create a high resolution timer in C#?

后端 未结 3 1943
青春惊慌失措
青春惊慌失措 2021-01-18 05:54

I\'ve used a Windows multimedia dll to created a high resolution timer with

timSetEvent()

But the timeSetEvent() page recommends the use

3条回答
  •  温柔的废话
    2021-01-18 06:15

    It's better to use timeSetEvent because its results are more consistent. On average modern hardware, for small intervals, the deviations in length of the intervals are about ten times smaller than when using CreateTimerQueueTimer. And that's assuming you didn't forget to increase the timer resolution before calling CreateTimerQueueTimer, otherwise the difference would be even bigger. So use timeSetEvent instead.

提交回复
热议问题