Another Timer fix, testing for backwards jumps in time

This commit is contained in:
Josh Faust 2009-09-23 22:47:00 +00:00
parent bc47e5f230
commit 55c8fd2df2
1 changed files with 10 additions and 0 deletions

View File

@ -384,6 +384,16 @@ void TimerManager<T, D, E>::threadFunc()
while (!new_timer_ && T::now() < sleep_end && !quit_)
{
// detect backwards jumps in time
if (T::now() < current)
{
ROS_DEBUG("Time jumped backwards, breaking out of sleep");
break;
}
current = T::now();
timers_cond_.timed_wait(lock, boost::posix_time::milliseconds(1));
}