diff --git a/src/System/RosImplementation/include/BipedalLocomotion/System/RosClock.h b/src/System/RosImplementation/include/BipedalLocomotion/System/RosClock.h index 99fd18d3ac..4b782cda45 100644 --- a/src/System/RosImplementation/include/BipedalLocomotion/System/RosClock.h +++ b/src/System/RosImplementation/include/BipedalLocomotion/System/RosClock.h @@ -58,19 +58,19 @@ class RosClock final : public IClock * @note `BipedalLocomotion::clock().now().count()` returns a double containing the seconds * since epoch. */ - std::chrono::duration now() final; + std::chrono::nanoseconds now() final; /** * Blocks the execution of the current thread for at least the specified sleepDuration. * @param time duration to sleep */ - void sleepFor(const std::chrono::duration& sleepDuration) final; + void sleepFor(const std::chrono::nanoseconds& sleepDuration) final; /** * Blocks the execution of the current thread until specified sleepTime has been reached. * @param time to block until */ - void sleepUntil(const std::chrono::duration& sleepTime) final; + void sleepUntil(const std::chrono::nanoseconds& sleepTime) final; /** * Provides a hint to the implementation to reschedule the execution of threads, allowing other diff --git a/src/System/RosImplementation/src/RosClock.cpp b/src/System/RosImplementation/src/RosClock.cpp index bd9550d9bb..04080ca998 100644 --- a/src/System/RosImplementation/src/RosClock.cpp +++ b/src/System/RosImplementation/src/RosClock.cpp @@ -14,18 +14,18 @@ using namespace BipedalLocomotion::System; -std::chrono::duration RosClock::now() +std::chrono::nanoseconds RosClock::now() { - return std::chrono::duration(m_clock.now().seconds()); + return std::chrono::nanoseconds(m_clock.now().nanoseconds()); } -void RosClock::sleepFor(const std::chrono::duration& sleepDuration) +void RosClock::sleepFor(const std::chrono::nanoseconds& sleepDuration) { // std::chrono::duration store the time in second m_clock.sleep_for(sleepDuration); } -void RosClock::sleepUntil(const std::chrono::duration& sleepTime) +void RosClock::sleepUntil(const std::chrono::nanoseconds& sleepTime) { m_clock.sleep_for(sleepTime - this->now()); }