You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your utils/Timer.h you should use std::chrono::steady_clock instead of std::chrono::high_resolution_clock.
The high_resolution_clock depends on the systems time which means that when you change your time, the clock will behave akwardly. So you can set your systems time to the future and your game will go insane.
To fix this issue just use the std::chrono::steady_clock which is based on your systems internal time counter.
Optional:
I would call the class a StopWatch rather than a timer.
The assumption up until now is that Timer is for timing/performance measurement, due to that it should use high resolution timers, but I agree it should be renamed to StopWatch. Making a variant of it which uses steady timer makes sense.
Of course, I also would advocate for using QueryPerformanceCounter/gettimeofday/mach_absolute_time as well.
In your utils/Timer.h you should use std::chrono::steady_clock instead of std::chrono::high_resolution_clock.
The high_resolution_clock depends on the systems time which means that when you change your time, the clock will behave akwardly. So you can set your systems time to the future and your game will go insane.
To fix this issue just use the std::chrono::steady_clock which is based on your systems internal time counter.
Optional:
I would call the class a StopWatch rather than a timer.
Here's the way i implemented it:
The text was updated successfully, but these errors were encountered: