YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Time.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_TIME_H
8#define YARP_OS_TIME_H
9
10#include <yarp/os/Clock.h>
12#include <yarp/os/SystemClock.h>
13
14#include <string>
15
16namespace yarp::os {
17
19{
20 No = 0,
21 Yes = 1
22};
23
32
33/*
34 * Services related to time -- delay, current time.
35 */
36namespace Time {
37
42YARP_os_API void delay(double seconds);
43
49YARP_os_API double now();
50
55YARP_os_API void yield();
56
61
77YARP_os_API void useNetworkClock(const std::string& clock, const std::string& localPortName = "");
78
90
95
100
105
110
115
121
127YARP_os_API bool isValid();
128
129} // namespace Time
130} // namespace yarp::os
131
132#endif // YARP_OS_TIME_H
A mini-server for performing network communication in the background.
yarpClockType getClockType()
Definition Time.cpp:270
bool isNetworkClock()
Check if YARP is providing network time.
Definition Time.cpp:260
void useSystemClock()
Configure YARP to use system time (this is the default).
Definition Time.cpp:137
bool isClockInitialized()
Check if YARP clock is initialized.
Definition Time.cpp:250
bool isValid()
Check if time is valid (non-zero).
Definition Time.cpp:307
void yield()
The calling thread releases its remaining quantum upon calling this function.
Definition Time.cpp:131
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition Time.cpp:121
void useNetworkClock(const std::string &clock, const std::string &localPortName="")
Configure YARP to read time from a specified topic.
Definition Time.cpp:177
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111
void useCustomClock(Clock *clock)
Configure YARP clients to use a custom clock source provided by the user.
Definition Time.cpp:220
bool isCustomClock()
Check if YARP is using a user-defined custom time.
Definition Time.cpp:265
bool isSystemClock()
Check if YARP is providing system time.
Definition Time.cpp:255
std::string clockTypeToString(yarpClockType type)
Converts clock type enum into string.
Definition Time.cpp:275
An interface to the operating system, including Port based communication.
ShouldUseSystemClock
Definition Time.h:19
yarpClockType
Definition Time.h:25
@ YARP_CLOCK_UNINITIALIZED
Definition Time.h:26
@ YARP_CLOCK_CUSTOM
Definition Time.h:30
@ YARP_CLOCK_SYSTEM
Definition Time.h:28
@ YARP_CLOCK_NETWORK
Definition Time.h:29
@ YARP_CLOCK_DEFAULT
Definition Time.h:27
#define YARP_os_API
Definition api.h:18