Can QueryPerformanceCounter return negative timestamps?

Copper Contributor

Dear community,

this is my first time asking a question here, so apologies if I am in the wrong place or have framed the question incorrectly. I have had a bit of trouble finding the right forum and I am willing to delete this post if I am in the wrong spot.

In our software, we use QueryPerformanceCounter and QueryPerformanceFrequency. We were under the impression that QueryPerformanceCounter could return negative, but increasing, timestamps. However, some searching online suggests that on Windows, getting negative timestamps from the high-performance timer, even if monotonically increasing, is a sign of a problem in the system, perhaps even a BIOS configuration issue. For example, see the following discussions:

I also saw some discussion that you could get negative timestamps when combining the output of QueryPerformanceCounter with the output of QueryPerformanceFrequency, if QueryPerformanceFrequency had an uncaught exception.

My question is: -> Is any of this true?

Many thanks and best wishes,

0 Replies