[windows] workaround for compiler error in Windows
See: https://connect.microsoft.com/VisualStudio/feedback/details/1179590
This commit is contained in:
parent
1e5b98f167
commit
22b53b991d
2 changed files with 8 additions and 7 deletions
|
@ -31,9 +31,10 @@ const std::chrono::seconds operator "" _s(unsigned long long s)
|
|||
{
|
||||
return std::chrono::seconds(s);
|
||||
}
|
||||
const std::chrono::duration<long double> operator "" _s(long double s)
|
||||
const std::chrono::nanoseconds operator "" _s(long double s)
|
||||
{
|
||||
return std::chrono::duration<long double>(s);
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<long double>(s));
|
||||
}
|
||||
|
||||
const std::chrono::nanoseconds
|
||||
|
@ -41,10 +42,11 @@ operator "" _ns(unsigned long long ns)
|
|||
{
|
||||
return std::chrono::nanoseconds(ns);
|
||||
}
|
||||
const std::chrono::duration<long double, std::nano>
|
||||
const std::chrono::nanoseconds
|
||||
operator "" _ns(long double ns)
|
||||
{
|
||||
return std::chrono::duration<long double, std::nano>(ns);
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<long double, std::nano>(ns));
|
||||
}
|
||||
|
||||
using rclcpp::node::Node;
|
||||
|
|
|
@ -133,13 +133,12 @@ get_global_sigint_guard_condition()
|
|||
return ::g_sigint_guard_cond_handle;
|
||||
}
|
||||
|
||||
template<class Rep, class Period>
|
||||
bool
|
||||
sleep_for(const std::chrono::duration<Rep, Period>& sleep_duration)
|
||||
sleep_for(const std::chrono::nanoseconds& nanoseconds)
|
||||
{
|
||||
// TODO: determine if posix's nanosleep(2) is more efficient here
|
||||
std::unique_lock<std::mutex> lock(::g_interrupt_mutex);
|
||||
auto cvs = ::g_interrupt_condition_variable.wait_for(lock, sleep_duration);
|
||||
auto cvs = ::g_interrupt_condition_variable.wait_for(lock, nanoseconds);
|
||||
return cvs == std::cv_status::no_timeout;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue