I'm doing a timing routine which uses QueryPerformanceCounter() but seems to get a bad tick count from QueryPerformanceCounter() now and then. The app is compiled in VC6 sp3 and run on NT4.0 sp5. Here's what happens:
1 - Call QueryPerformanceFrequency() to get ticks per second.
2 - Call QueryPerformanceCounter() to get the start time
3 - Do some work (and wait using a waitable timer)
4 - Call QueryPerformanceCounter() to get the end time
5 - Get delta time (end - start) and use it
6 - Set start time = end time
7 - Go to step 4 until all work done
The delta I get back sometimes indicates a tick count greater than 73K seconds. Bloody long time. The actual time I spend in the loop is on the order of 100 ms though. I (and several others) have checked the logic and it appears fine (and like I said, this only happens sometimes).
I use the performance counter because we need very tight resolution. Has anyone has seen problems like this with QueryPerformanceCounter() before?