I've an application that requires timers with 1msec precision. Under windows I call timeBeginPeriod(1) at the begin of main() to ensure 1msec resolution (and timeEndPeriod(1) before program exit). I've some threads that perform periodic activities that use WaitableTimer/WaitForSingleObject to sleep for the required time period.
Sometimes the application starts and works fine (sleep times are correct). Other times the application starts and the timer gets fired at a multiple of 15msec (6 msec timers fired at 15 msec, 20 msec timers fired at 30 msec). If I run the TimerResolution application, it reports that the Windows timer resolution is 1msec (0,997 msec), but yet timers are not fired correctly. If I simply restart the computer, timers return working fine.
I've found the problem occurring on Windows 10 1803, 1909 and 2004. I know timer resolution handling was changed since Windows 2004, but I thought that the problem was not present on previous Windows 10 versions.
Any idea where I can look at into Windows when the problem shows up, in order to understand why timers are not properly fired ?
Thanks, Massimo