32static unsigned s_deltaTimeMs;
36 return s_absoluteTimeMs;
46 return s_deltaTimeMs / 1000.f;
49static int32_t getElapsedTime(
uint32_t timeMs)
51 return static_cast<int32_t
>(s_absoluteTimeMs - timeMs);
58 const uint32_t previousTime = s_absoluteTimeMs;
59 s_absoluteTimeMs = SDL_GetTicks();
60 s_deltaTimeMs = std::clamp(getElapsedTime(previousTime), 0, 1000);
67 return Time::getElapsedTime(
mTimeout);
int32_t elapsed() const
Returns the number of milliseconds elapsed since the set time, or a negative value if the timer hasn'...
unsigned deltaTimeMs()
The time in milliseconds since the last frame, but never more than 1000.
float deltaTime()
The time in seconds since the last frame, but never more than 1.
void beginFrame()
Called at the start of each frame, updates the above variables.
uint32_t absoluteTimeMs()
The time in milliseconds since the program started (wraps around after ~49 days).