YARP  2.3.70
Yet Another Robot Platform
yarp::os::Time Class Reference

Services related to time – delay, current time. More...

#include <yarp/os/Time.h>

Static Public Member Functions

static void delay (double seconds)
 Wait for a certain number of seconds. More...
 
static double now ()
 Return the current time in seconds, relative to an arbitrary starting point. More...
 
static void yield ()
 The calling thread releases its remaining quantum upon calling this function. More...
 
static void turboBoost ()
 For OS where it makes sense sets the scheduler to be called more often. More...
 
static void useSystemClock ()
 Configure YARP to use system time (this is the default). More...
 
static void useNetworkClock (const ConstString &clock)
 Configure YARP to read time from a specified topic. More...
 
static void useCustomClock (Clock *clock)
 Provide a custom time source. More...
 
static bool isSystemClock ()
 Check if YARP is providing system time. More...
 
static bool isValid ()
 Check if time is valid (non-zero). More...
 

Detailed Description

Services related to time – delay, current time.

Definition at line 24 of file Time.h.

Member Function Documentation

◆ delay()

◆ isSystemClock()

bool Time::isSystemClock ( )
static

Check if YARP is providing system time.

Definition at line 138 of file Time.cpp.

◆ isValid()

bool Time::isValid ( )
static

Check if time is valid (non-zero).

If a network clock is in use and no timestamp has yet been received, this method will return false.

Definition at line 142 of file Time.cpp.

◆ now()

double Time::now ( )
static

Return the current time in seconds, relative to an arbitrary starting point.

Returns
the time in seconds
Examples:
framerate/main.cpp, and portaudio/sound_sender_mic.cpp.

Definition at line 91 of file Time.cpp.

◆ turboBoost()

void Time::turboBoost ( )
static

For OS where it makes sense sets the scheduler to be called more often.

This sets the scheduler to be run to the maximum possible rate based on the capability of the hardware. Specifically, on Microsoft Windows, high resolution scheduling is used.

Definition at line 97 of file Time.cpp.

◆ useCustomClock()

void Time::useCustomClock ( Clock clock)
static

Provide a custom time source.

Definition at line 130 of file Time.cpp.

◆ useNetworkClock()

void Time::useNetworkClock ( const ConstString clock)
static

Configure YARP to read time from a specified topic.

The same effect can also be achieved using the YARP_CLOCK environment variable. Topic should provide two integers, time in seconds followed by residual in nanoseconds. If yarp is configured according to Using YARP with ROS, then ROS /clock topic will work.

See also
yarp::os::NetworkClock

Definition at line 122 of file Time.cpp.

◆ useSystemClock()

void Time::useSystemClock ( )
static

Configure YARP to use system time (this is the default).

Definition at line 116 of file Time.cpp.

◆ yield()

void Time::yield ( )
static

The calling thread releases its remaining quantum upon calling this function.

Definition at line 106 of file Time.cpp.


The documentation for this class was generated from the following files: