diff --git a/stepmania/src/RageTimer.cpp b/stepmania/src/RageTimer.cpp index 381eab659b..ed5b27da59 100644 --- a/stepmania/src/RageTimer.cpp +++ b/stepmania/src/RageTimer.cpp @@ -23,13 +23,18 @@ const float SECS_IN_DAY = 60*60*24; /* XXX: SDL_GetTicks() wraps every month or so. Handle it. */ RageTimer::RageTimer() +{ + Init(); + GetDeltaTime(); /* so the next call to GetDeltaTime is from the construction of this object */ +} + +void RageTimer::Init() { static bool SDL_Initialized = false; if(!SDL_Initialized) { SDL_InitSubSystem(SDL_INIT_TIMER); SDL_Initialized = true; } - GetDeltaTime(); /* so the next call to GetDeltaTime is from the construction of this object */ } float RageTimer::GetDeltaTime() @@ -46,7 +51,7 @@ float RageTimer::PeekDeltaTime() const return (SDL_GetTicks() - m_iLastDeltaTime) / 1000.f; } -float RageTimer::GetTimeSinceStart() const +float RageTimer::GetTimeSinceStart() { return SDL_GetTicks() / 1000.f; } diff --git a/stepmania/src/RageTimer.h b/stepmania/src/RageTimer.h index f300d7f953..97fa9766ae 100644 --- a/stepmania/src/RageTimer.h +++ b/stepmania/src/RageTimer.h @@ -19,9 +19,10 @@ public: unsigned int GetTicks(); float GetDeltaTime(); // time between last call to GetDeltaTime() float PeekDeltaTime() const; - float GetTimeSinceStart() const; // seconds since the program was started + static float GetTimeSinceStart(); // seconds since the program was started private: + static void Init(); int m_iLastDeltaTime; };