Orocos Real-Time Toolkit
2.8.3
|
The TimeService is used for system-wide time keeping and conversions. More...
#include <rtt/os/TimeService.hpp>
Public Types | |
typedef double | Seconds |
The type used to store SI unit time keeping. More... | |
typedef long | secs |
An integer representation of seconds. More... | |
typedef long | msecs |
An integer representation of miliseconds. More... | |
typedef long | usecs |
An integer representation of microseconds. More... | |
typedef long long | nsecs |
An integer representation of nanoseconds. More... | |
typedef long long | ticks |
The type for the systems clock tick. More... | |
Public Member Functions | |
virtual | ~TimeService () |
Destructor. More... | |
ticks | ticksGet () const |
Get current tick of the System clock. More... | |
ticks | getTicks () const |
Get current tick of the System clock. More... | |
ticks | ticksGet (ticks &relativeTime) const |
Get clicks passed since a certain moment. More... | |
ticks | getTicks (ticks &relativeTime) const |
Get clicks passed since a certain moment. More... | |
ticks | ticksSince (ticks relativeTime) const |
Get clicks passed since a certain moment. More... | |
Seconds | secondsGet (ticks &relativeTime) const |
Get the time in seconds passed since a certain moment. More... | |
Seconds | getSeconds (ticks &relativeTime) const |
Get the time in seconds passed since a certain moment. More... | |
Seconds | secondsSince (ticks relativeTime) const |
Get Seconds passed since a certain moment. More... | |
Seconds | secondsChange (Seconds delta) |
Change the time with delta seconds. More... | |
ticks | ticksChange (ticks delta) |
Change the time with delta ticks. More... | |
void | enableSystemClock (bool yes_no) |
Enables or disables reading the system clock. More... | |
bool | systemClockEnabled () const |
Check if the system clock is being read. More... | |
nsecs | getNSecs () const |
Get current nsecs of the System clock. More... | |
nsecs | getNSecs (nsecs &relativeTime) const |
Get nsecs passed since a certain moment. More... | |
Static Public Member Functions | |
static TimeService * | Instance () |
static bool | Release () |
Releases the TimeService Reference counting might aid in making this call safe. More... | |
static ticks | nsecs2ticks (const nsecs m) |
Convert an amount of nano seconds to System ticks. More... | |
static nsecs | ticks2nsecs (const ticks t) |
Convert an amount of ticks to nano seconds. More... | |
Static Public Attributes | |
static const ticks | InfiniteTicks = ::InfiniteTicks |
The largest number representable in ticks. More... | |
static const nsecs | InfiniteNSecs = ::InfiniteNSecs |
The largest number representable in nsecs. More... | |
static const Seconds | InfiniteSeconds = ::InfiniteSeconds |
The largest number representable in Seconds. More... | |
Protected Member Functions | |
TimeService () | |
Constructor. More... | |
The TimeService is used for system-wide time keeping and conversions.
Definition at line 35 of file TimeService.hpp.
typedef long RTT::os::TimeService::msecs |
An integer representation of miliseconds.
Definition at line 51 of file TimeService.hpp.
typedef long long RTT::os::TimeService::nsecs |
An integer representation of nanoseconds.
Definition at line 61 of file TimeService.hpp.
typedef double RTT::os::TimeService::Seconds |
The type used to store SI unit time keeping.
Definition at line 41 of file TimeService.hpp.
typedef long RTT::os::TimeService::secs |
An integer representation of seconds.
Definition at line 46 of file TimeService.hpp.
typedef long long RTT::os::TimeService::ticks |
The type for the systems clock tick.
Definition at line 66 of file TimeService.hpp.
typedef long RTT::os::TimeService::usecs |
An integer representation of microseconds.
Definition at line 56 of file TimeService.hpp.
|
virtual |
Destructor.
Definition at line 71 of file TimeService.cpp.
|
protected |
void RTT::TimeService::enableSystemClock | ( | bool | yes_no | ) |
Enables or disables reading the system clock.
If disabled, you'll have to change time using secondsChange.
Definition at line 76 of file TimeService.cpp.
References rtos_get_time_ticks().
Referenced by RTT::extras::SimulationThread::finalize(), and RTT::extras::SimulationThread::initialize().
TimeService::nsecs RTT::TimeService::getNSecs | ( | ) | const |
Get current nsecs of the System clock.
Definition at line 151 of file TimeService.cpp.
References rtos_get_time_ns().
Referenced by getNSecs().
TimeService::nsecs RTT::TimeService::getNSecs | ( | TimeService::nsecs & | relativeTime | ) | const |
Get nsecs passed since a certain moment.
Definition at line 157 of file TimeService.cpp.
References getNSecs().
TimeService::Seconds RTT::TimeService::getSeconds | ( | TimeService::ticks & | relativeTime | ) | const |
Get the time in seconds passed since a certain moment.
Definition at line 125 of file TimeService.cpp.
References getTicks(), RTT::nsecs_to_Seconds(), and ticks2nsecs().
TimeService::ticks RTT::TimeService::getTicks | ( | ) | const |
Get current tick of the System clock.
Definition at line 101 of file TimeService.cpp.
References rtos_get_time_ticks().
Referenced by getSeconds(), getTicks(), RTT::scripting::DataSourceTime::reset(), RTT::scripting::ConditionDuration::reset(), RTT::scripting::ConditionDSDuration::reset(), RTT::Logger::startup(), and ticksSince().
TimeService::ticks RTT::TimeService::getTicks | ( | TimeService::ticks & | relativeTime | ) | const |
Get clicks passed since a certain moment.
Definition at line 107 of file TimeService.cpp.
References getTicks().
Referenced by getTicks().
|
static |
Definition at line 41 of file TimeService.cpp.
References TimeService().
Referenced by RTT::Logger::D::showTime(), and RTT::Logger::startup().
|
static |
Convert an amount of nano seconds to System ticks.
m | The amount of nano seconds |
Definition at line 31 of file TimeService.cpp.
References nano2ticks().
Referenced by secondsChange().
|
static |
Releases the TimeService Reference counting might aid in making this call safe.
Definition at line 52 of file TimeService.cpp.
Referenced by __os_exit().
TimeService::Seconds RTT::TimeService::secondsChange | ( | TimeService::Seconds | delta | ) |
Change the time with delta seconds.
Definition at line 137 of file TimeService.cpp.
References nsecs2ticks(), RTT::nsecs_to_Seconds(), RTT::Seconds_to_nsecs(), ticks2nsecs(), and ticksSince().
Referenced by RTT::extras::SimulationThread::run(), and RTT::extras::SimulationThread::step().
Get the time in seconds passed since a certain moment.
Definition at line 133 of file TimeService.hpp.
TimeService::Seconds RTT::TimeService::secondsSince | ( | TimeService::ticks | relativeTime | ) | const |
Get Seconds passed since a certain moment.
If relativeTime is zero, the absolute syteme time is given.
Definition at line 131 of file TimeService.cpp.
References RTT::nsecs_to_Seconds(), ticks2nsecs(), and ticksSince().
Referenced by RTT::scripting::ConditionDSDuration::evaluate(), RTT::scripting::DataSourceTime::get(), and RTT::Logger::D::showTime().
bool RTT::TimeService::systemClockEnabled | ( | ) | const |
Check if the system clock is being read.
Definition at line 95 of file TimeService.cpp.
|
static |
Convert an amount of ticks to nano seconds.
Definition at line 36 of file TimeService.cpp.
References ticks2nano().
Referenced by RTT::scripting::ConditionDuration::evaluate(), getSeconds(), secondsChange(), secondsSince(), and RTT::Logger::startup().
TimeService::ticks RTT::TimeService::ticksChange | ( | TimeService::ticks | delta | ) |
Change the time with delta ticks.
Definition at line 144 of file TimeService.cpp.
References ticksSince().
|
inline |
Get current tick of the System clock.
Definition at line 90 of file TimeService.hpp.
Get clicks passed since a certain moment.
Definition at line 106 of file TimeService.hpp.
TimeService::ticks RTT::TimeService::ticksSince | ( | TimeService::ticks | relativeTime | ) | const |
Get clicks passed since a certain moment.
If relativeTime is zero, the absolute system time is given.
Definition at line 118 of file TimeService.cpp.
References getTicks().
Referenced by RTT::scripting::ConditionDuration::evaluate(), secondsChange(), secondsSince(), and ticksChange().
|
static |
The largest number representable in nsecs.
Definition at line 213 of file TimeService.hpp.
|
static |
The largest number representable in Seconds.
Definition at line 218 of file TimeService.hpp.
|
static |
The largest number representable in ticks.
Definition at line 208 of file TimeService.hpp.