YARP
Yet Another Robot Platform
Time.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_TIME_H
11 #define YARP_OS_TIME_H
12 
13 #include <yarp/os/Clock.h>
14 #include <yarp/os/NetworkClock.h>
15 #include <yarp/os/SystemClock.h>
16 
17 #include <string>
18 
19 namespace yarp {
20 namespace os {
21 
23 {
24  No = 0,
25  Yes = 1
26 };
27 
29 {
35 };
36 
37 /*
38  * Services related to time -- delay, current time.
39  */
40 namespace Time {
41 
46 YARP_os_API void delay(double seconds);
47 
53 YARP_os_API double now();
54 
59 YARP_os_API void yield();
60 
65 
81 YARP_os_API void useNetworkClock(const std::string& clock, const std::string& localPortName = "");
82 
93 YARP_os_API void useCustomClock(Clock* clock);
94 
99 
104 
109 
114 
119 
125 
131 YARP_os_API bool isValid();
132 
133 #ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
134 
144 YARP_os_API void turboBoost();
145 #endif
146 
147 } // namespace Time
148 } // namespace os
149 } // namespace yarp
150 
151 #endif // YARP_OS_TIME_H
std_msgs::Time
yarp::rosmsg::std_msgs::Time Time
Definition: Time.h:24
yarp::os::YARP_CLOCK_UNINITIALIZED
@ YARP_CLOCK_UNINITIALIZED
Definition: Time.h:30
yarp::os::YARP_CLOCK_DEFAULT
@ YARP_CLOCK_DEFAULT
Definition: Time.h:31
SystemClock.h
yarp::os::ShouldUseSystemClock::No
@ No
yarp::os::Time::isValid
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:317
yarp::os::Clock
Definition: Clock.h:18
YARP_DEPRECATED
#define YARP_DEPRECATED
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2882
yarp::os::Time::isCustomClock
bool isCustomClock()
Check if YARP is using a user-defined custom time.
Definition: Time.cpp:275
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::os::Time::now
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition: Time.cpp:124
Clock.h
yarp::os::Time::useSystemClock
void useSystemClock()
Configure YARP to use system time (this is the default).
Definition: Time.cpp:147
yarp::os::YARP_CLOCK_SYSTEM
@ YARP_CLOCK_SYSTEM
Definition: Time.h:32
yarp::os::YARP_CLOCK_NETWORK
@ YARP_CLOCK_NETWORK
Definition: Time.h:33
yarp::os::Time::getClockType
yarpClockType getClockType()
Definition: Time.cpp:280
yarp::os::Time::yield
void yield()
The calling thread releases its remaining quantum upon calling this function.
Definition: Time.cpp:141
yarp::os::Time::turboBoost
void turboBoost()
For OS where it makes sense sets the scheduler to be called more often.
Definition: Time.cpp:135
NetworkClock.h
yarp::os::Time::useNetworkClock
void useNetworkClock(const std::string &clock, const std::string &localPortName="")
Configure YARP to read time from a specified topic.
Definition: Time.cpp:187
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::ShouldUseSystemClock
ShouldUseSystemClock
Definition: Time.h:23
yarp::os::Time::isSystemClock
bool isSystemClock()
Check if YARP is providing system time.
Definition: Time.cpp:265
yarp::os::Time::clockTypeToString
std::string clockTypeToString(yarpClockType type)
Converts clock type enum into string.
Definition: Time.cpp:285
yarp::os::Time::isClockInitialized
bool isClockInitialized()
Check if YARP clock is initialized.
Definition: Time.cpp:260
yarp::os::YARP_CLOCK_CUSTOM
@ YARP_CLOCK_CUSTOM
Definition: Time.h:34
yarp::os::Time::useCustomClock
void useCustomClock(Clock *clock)
Configure YARP clients to use a custom clock source provided by the user.
Definition: Time.cpp:230
yarp::os::Time::delay
void delay(double seconds)
Wait for a certain number of seconds.
Definition: Time.cpp:114
yarp::os::Time::isNetworkClock
bool isNetworkClock()
Check if YARP is providing network time.
Definition: Time.cpp:270
yarp::os::yarpClockType
yarpClockType
Definition: Time.h:29