You are welcome and have a good day.
Can QueryPerformanceCounter return negative timestamps?
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.
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:
https://github.com/SFML/SFML/issues/1167
https://stackoverflow.com/questions/31326115/queryperformancecounter-and-weird-results
https://cboard.cprogramming.com/cplusplus-programming/97413-queryperformancefrequency-negative-value.html
https://learn.microsoft.com/en-us/troubleshoot/windows-server/performance/programs-queryperformancecounter-function-perform-poorly
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,
Rob
Windows for home | Windows 11 | Performance and system failures
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
3 answers
Sort by: Most helpful
-
Anonymous
2024-07-01T17:57:34+00:00 Wonderful! Thank you.
I will post it there.
Best regards,
Rob -
paulr0511 45,605 Reputation points Independent Advisor
2024-07-01T16:58:44+00:00 Good day Robert! I would suggest to post this query to our neighbor forum from the link below as this is best suited in there. They are more oriented on with regards to this type queries/issues and there will be IT Pros and Gurus and the likes who has the same deployment or setup in this type of environment and are available that will be able to fulfill your query out there.
https://learn.microsoft.com/en-us/answers/ask
Regards,
Paul R.