If time jumps backwards, don't reset timers added since time jumped

This commit is contained in:
Josh Faust 2009-09-24 00:24:18 +00:00
parent 3e6af81abf
commit 2721d7d0c2
1 changed files with 7 additions and 2 deletions

View File

@ -338,8 +338,13 @@ void TimerManager<T, D, E>::threadFunc()
for (; it != end; ++it)
{
const TimerInfoPtr& info = *it;
info->last_expected = current;
info->next_expected = current + info->period;
// Timer may have been added after the time jump, so also check if time has jumped past its last call time
if (current < info->last_expected)
{
info->last_expected = current;
info->next_expected = current + info->period;
}
}
}