-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,22 +46,6 @@ | |
namespace ros | ||
{ | ||
|
||
namespace { | ||
template<class T> | ||
class TimerManagerTraits | ||
{ | ||
public: | ||
typedef boost::chrono::system_clock::time_point time_point; | ||
}; | ||
|
||
template<> | ||
class TimerManagerTraits<SteadyTime> | ||
{ | ||
public: | ||
typedef boost::chrono::steady_clock::time_point time_point; | ||
}; | ||
} | ||
|
||
template<class T, class D, class E> | ||
class TimerManager | ||
{ | ||
|
@@ -592,8 +576,8 @@ void TimerManager<T, D, E>::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<T>::time_point end_tp(boost::chrono::nanoseconds(sleep_end.toNSec())); | ||
timers_cond_.wait_until(lock, end_tp); | ||
int64_t remaining_time = std::max<int64_t>((sleep_end - current).toSec() * 1000.0f, 1); | ||
timers_cond_.wait_for(lock, boost::chrono::milliseconds(remaining_time)); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
flixr
Contributor
|
||
} | ||
} | ||
|
||
|
To be clear, replacing
wait_until(sleep_end)
withwait_for(sleep_end - current)
is not exactly the same.But I guess for how these Timers are supposed to be used it's ok.