| 25 | #include "console/engineAPI.h" |
| 26 | |
| 27 | void TimeManager::_updateTime() |
| 28 | { |
| 29 | // Calculate & filter time delta since last event. |
| 30 | |
| 31 | // How long since last update? |
| 32 | S32 delta = mTimer->getElapsedMs(); |
| 33 | |
| 34 | // Now - we want to try to sleep until the time threshold will hit. |
| 35 | S32 msTillThresh = (mBackground ? mBackgroundThreshold : mForegroundThreshold) - delta; |
| 36 | |
| 37 | if(msTillThresh > 0) |
| 38 | { |
| 39 | // There's some time to go, so let's sleep. |
| 40 | Platform::sleep( msTillThresh ); |
| 41 | } |
| 42 | |
| 43 | // Ok - let's grab the new elapsed and send that out. |
| 44 | S32 finalDelta = mTimer->getElapsedMs(); |
| 45 | mTimer->reset(); |
| 46 | |
| 47 | timeEvent.trigger(finalDelta); |
| 48 | } |
| 49 | |
| 50 | TimeManager::TimeManager() |
| 51 | { |
nothing calls this directly
no test coverage detected