class final
YarpClockYarpClock implements the IClock interface using yarp functions.
The clock can be easily used as follows
#include <BipedalLocomotion/System/Clock.h> #include <BipedalLocomotion/System/YarpClock.h> // Change the clock BipedalLocomotion::System::ClockBuilder::setFactory(std::make_shared<BipedalLocomotion::System::YarpClockFactory>())); auto start = BipedalLocomotion::clock().now(); foo(); auto end = BipedalLocomotion::clock().now(); std::chrono::duration<double, std::milli> elapsed = end-start;
Base classes
Public functions
- auto now() -> std::chrono::nanoseconds final
- Get YARP current time.
- void sleepFor(const std::chrono::nanoseconds& sleepDuration) final
- Blocks the execution of the current thread for at least the specified sleepDuration.
- void sleepUntil(const std::chrono::nanoseconds& sleepTime) final
- Blocks the execution of the current thread until specified sleepTime has been reached.
- void yield() final
- Provides a hint to the implementation to reschedule the execution of threads, allowing other threads to run.
Function documentation
std::chrono::nanoseconds BipedalLocomotion:: System:: YarpClock:: now() final
Get YARP current time.
Returns | the current time computed from yarp::os::Time::now() |
---|