diff --git a/clients/roscpp/include/ros/timer_manager.h b/clients/roscpp/include/ros/timer_manager.h index ecf7088bdd..e574d0ea6c 100644 --- a/clients/roscpp/include/ros/timer_manager.h +++ b/clients/roscpp/include/ros/timer_manager.h @@ -46,22 +46,6 @@ namespace ros { -namespace { - template - class TimerManagerTraits - { - public: - typedef boost::chrono::system_clock::time_point time_point; - }; - - template<> - class TimerManagerTraits - { - public: - typedef boost::chrono::steady_clock::time_point time_point; - }; -} - template class TimerManager { @@ -592,8 +576,8 @@ void TimerManager::threadFunc() { // On system time we can simply sleep for the rest of the wait time, since anything else requiring processing will // signal the condition variable - typename TimerManagerTraits::time_point end_tp(boost::chrono::nanoseconds(sleep_end.toNSec())); - timers_cond_.wait_until(lock, end_tp); + int64_t remaining_time = std::max((sleep_end - current).toSec() * 1000.0f, 1); + timers_cond_.wait_for(lock, boost::chrono::milliseconds(remaining_time)); } }