Handmade Hero»Forums»Code
18 posts
Over 34 ms per frame

I am on day 18 and when I run Casey's code it triggers his Assert on test seconds being less than target seconds.

I saw on here that some people had trouble with Sleep, so I commented that out so I just use the while loop updating the elapsed time, however I still am seeing 34.2 ish milliseconds per frame.

Has anyone else encountered this? I am having trouble dubugging the issue because when the debugger pauses the application, the times reported back from the query performance counter are wrong.
Oliver Marsh
193 posts / 1 project
Over 34 ms per frame
Edited by Oliver Marsh on
I think we eventually changed the Assert to an if statement, so the game only slept if we were under the frame per seconds.

On my computer I found that I was a little over (34ms - 37ms) after sleeping whereas Casey's was spot on. Maybe it has to do with the operating system sleep granularity (I was using windows eight)?

Hope this helps. :)