Question about QueryPerformanceCounter

Started by
1 comment, last by nobodynews 13 years, 8 months ago
Hey guys,

QueryPerformanceCounter takes in a LARGE_INTEGER* in which it stores the counter value. I was wondering whether an overflow can occur if the value stored in the LARGE_INTEGER variable is too large? that is if I leave my game open for too long?

I wanted to know how QueryPerformanceCounter worked. Does the counter value increase over time? or is there a mechanism to keep under the maximum value that can be stored in a LARGE_INTEGER?

Thanks
Advertisement
LARGE_INTEGER is a 64bit integer, there's no chance it will overflow from running too long, it will take years to overflow.

[Edited by - marsong on August 10, 2010 1:26:49 PM]
Well it all depends on what QueryPerformanceFrequency returns. If QPF returns something roughly equal to a modern processor speed (3GHz) and the largest value of LARGE_INTEGER is 2^64 then it will take something like 200 years to roll over.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

This topic is closed to new replies.

Advertisement