Advertisement Jump to content


This topic is now archived and is closed to further replies.


QueryPerformanceCounter question.

This topic is 5683 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I noticed that QueryPerformanceCounter uses a signed LARGE_INTEGER to store the time value. Isn''t this a little odd? When a wrap-around occurs does QPC start returning negative values or does it catch this and wrap to zero? I''d test it myself but I''m not leaving my PC on that long.

Share this post

Link to post
Share on other sites
A LARGER_INTEGER is 64 bits. A signed large integer is between 2^63-1 and -(2^63), since you are excluding the sign bit. This is 9,223,372,036,854,775,807 and -9,223,372,036,854,775,808.

On my machine, the performance counter frequency is 1,680,440,000 ticks per second.

Dividing 9,223,372,036,854,775,807 by 1,680,440,000 gives 5,488,664,895 (that's max upper limit in total seconds for a performance counter).

5,488,664,895 seconds is 91,477,748.25 minutes or 1,524,629.1375 hours or 63,526.2140625 days or 173.9253 years.

I don't think you will be around in 173.9253 years, so your question is pretty much moot.


[edited by - botman on July 2, 2003 8:59:35 AM]

Share this post

Link to post
Share on other sites
Thanks...I''d neved actually done the math to see how often a wrap would occur. I randomly guessed maybe a month or so (well within possible limits for a PC to be turned on)! :O

Interestingly enough, after your example I checked my frequency and my counter runs at about 3.5 million per second, so it will only wrap roughly every eighty thousand years ! Hopefully I''ll have a new PC by then.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!