void Clock::refresh() { time_t systime = getCurrentSystemTime(); time_t time_incr = (time_t) ((systime - last_refresh_sys_) * ratio_); now_ += time_incr; last_refresh_sys_ = systime; }
// Start the timer inline void Timer::start() { if (!mIsRunning) { // Get the current system time mLastUpdateTime = getCurrentSystemTime(); mAccumulator = 0.0; mIsRunning = true; } }
void XabslEngineExecutor::init(InputSource& input) { if (pEngine != 0) delete pEngine; errorHandler.errorsOccurred = false; // reset the error handler unsigned long startTime = getCurrentSystemTime(); pEngine = new Engine(errorHandler,&getCurrentSystemTime); registerSymbolsAndBasicBehaviors(); pEngine->createOptionGraph(input); if (!errorHandler.errorsOccurred) { errorHandler.message("created a new Engine (%li ms)", getCurrentSystemTime() - startTime ); } }
// Compute the time since the last update() call and add it to the accumulator inline void Timer::update() { // Get the current system time long double currentTime = getCurrentSystemTime(); // Compute the delta display time between two display frames mDeltaTime = currentTime - mLastUpdateTime; // Update the current display time mLastUpdateTime = currentTime; // Update the accumulator value mAccumulator += mDeltaTime; }
time_t Clock::getUTime() { return getCurrentSystemTime(); }
void Clock::setNow(time_t now) { now_ = now; time_t systime = getCurrentSystemTime(); last_refresh_sys_ = systime; }
Clock::Clock(void) : ratio_(1.0f) { last_refresh_sys_ = getCurrentSystemTime(); now_ = last_refresh_sys_; }