Home / Accurate timers on Windows

From this blog post on using accurate timers on Windows.

CraeteWaitableTimer API is similar to SetTimer. You can specify timeout and a callback function. It has the following advantages:

  • you can specify a delay
  • it returns a kernel handle you can wait on
  • it allows pasing context data pointer to a callback function
  • waitable timers are much more accurate as they are not calculated during idle and messages aren’t collapsed
  • you can adjust the parameters of the timer with SetWaitableTimer and cancel it with CancelWaitableTimer..