Go to the documentation of this file.
17 #ifndef GZ_TRANSPORT_CLOCK_HH_
18 #define GZ_TRANSPORT_CLOCK_HH_
24 #include <gz/utilities/SuppressWarning.hh>
26 #include "gz/transport/config.hh"
27 #include "gz/transport/Export.hh"
34 inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE {
38 class IGNITION_TRANSPORT_VISIBLE
Clock
46 public:
virtual bool IsReady()
const = 0;
49 public:
virtual ~
Clock() =
default;
72 const TimeBase _timeBase = TimeBase::SIM);
86 public:
bool IsReady()
const override;
89 private:
class Implementation;
92 IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
94 IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
109 public:
bool IsReady()
const override;
118 private:
class Implementation;
121 IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
123 IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
bool IsReady() const override
Checks whether the clock is ready to be used or not.
Definition: gz/transport/AdvertiseOptions.hh:28
@ REAL
Use Clock message real time field as time base.
@ SYS
Use Clock message sys time field as time base.
A Clock interface implementation that uses gz::msgs::Clock messages distributed across the network.
Definition: gz/transport/Clock.hh:56
void SetTime(const std::chrono::nanoseconds _time)
Sets and distributes the given clock time.
static WallClock * Instance()
Returns system wall clock interface.
NetworkClock(const std::string &_topicName, const TimeBase _timeBase=TimeBase::SIM)
Constructor that sets the initial time range option.
std::chrono::nanoseconds Time() const override
Gets clock time.
virtual std::chrono::nanoseconds Time() const =0
Gets clock time.
virtual bool IsReady() const =0
Checks whether the clock is ready to be used or not.
A Clock interface for time tracking.
Definition: gz/transport/Clock.hh:38
~NetworkClock() override
Destructor.
@ SIM
Use Clock message sim time field as time base.
virtual ~Clock()=default
Virtual destructor.
TimeBase
Network clock time bases.
Definition: gz/transport/Clock.hh:59
bool IsReady() const override
Checks whether the clock is ready to be used or not.
std::chrono::nanoseconds Time() const override
Gets clock time.
A Clock implementation that leverages host OS time APIs.
Definition: gz/transport/Clock.hh:99