Orocos Real-Time Toolkit
2.5.0
|
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. | |
typedef long | secs |
An integer representation of seconds. | |
typedef long | msecs |
An integer representation of miliseconds. | |
typedef long | usecs |
An integer representation of microseconds. | |
typedef long long | nsecs |
An integer representation of nanoseconds. | |
typedef long long | ticks |
The type for the systems clock tick. | |
Public Member Functions | |
virtual | ~TimeService () |
Destructor. | |
ticks | ticksGet () const |
Get current tick of the System clock. | |
ticks | getTicks () const |
Get current tick of the System clock. | |
ticks | ticksGet (ticks &relativeTime) const |
Get clicks passed since a certain moment. | |
ticks | getTicks (ticks &relativeTime) const |
Get clicks passed since a certain moment. | |
ticks | ticksSince (ticks relativeTime) const |
Get clicks passed since a certain moment. | |
Seconds | secondsGet (ticks &relativeTime) const |
Get the time in seconds passed since a certain moment. | |
Seconds | getSeconds (ticks &relativeTime) const |
Get the time in seconds passed since a certain moment. | |
Seconds | secondsSince (ticks relativeTime) const |
Get Seconds passed since a certain moment. | |
Seconds | secondsChange (Seconds delta) |
Change the time with delta seconds. | |
void | enableSystemClock (bool yes_no) |
Enables or disables reading the system clock. | |
nsecs | getNSecs () const |
Get current nsecs of the System clock. | |
nsecs | getNSecs (nsecs &relativeTime) const |
Get nsecs passed since a certain moment. | |
Static Public Member Functions | |
static TimeService * | Instance () |
static bool | Release () |
Releases the TimeService Reference counting might aid in making this call safe. | |
static ticks | nsecs2ticks (const nsecs m) |
Convert an amount of nano seconds to System ticks. | |
static nsecs | ticks2nsecs (const ticks t) |
Convert an amount of ticks to nano seconds. | |
Static Public Attributes | |
static const ticks | InfiniteTicks = ::InfiniteTicks |
The largest number representable in ticks. | |
static const nsecs | InfiniteNSecs = ::InfiniteNSecs |
The largest number representable in nsecs. | |
static const Seconds | InfiniteSeconds = ::InfiniteSeconds |
The largest number representable in Seconds. | |
Protected Member Functions | |
TimeService () | |
Constructor. |
The TimeService is used for system-wide time keeping and conversions.
Definition at line 35 of file TimeService.hpp.
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.
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 140 of file TimeService.cpp.
Referenced by RTT::os::Timer::arm(), getNSecs(), RTT::os::Timer::startTimer(), and RTT::os::Timer::timeRemaining().
TimeService::nsecs RTT::TimeService::getNSecs | ( | TimeService::nsecs & | relativeTime | ) | const |
Get nsecs passed since a certain moment.
Definition at line 146 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 121 of file TimeService.cpp.
References getTicks(), and ticks2nsecs().
TimeService::ticks RTT::TimeService::getTicks | ( | ) | const |
Get current tick of the System clock.
Definition at line 97 of file TimeService.cpp.
Referenced by getSeconds(), getTicks(), RTT::scripting::ConditionDuration::reset(), RTT::scripting::ConditionDSDuration::reset(), and ticksSince().
TimeService::ticks RTT::TimeService::getTicks | ( | TimeService::ticks & | relativeTime | ) | const |
Get clicks passed since a certain moment.
Definition at line 103 of file TimeService.cpp.
References getTicks().
TimeService::ticks RTT::TimeService::nsecs2ticks | ( | const nsecs | m | ) | [static] |
Convert an amount of nano seconds to System ticks.
m | The amount of nano seconds |
Definition at line 31 of file TimeService.cpp.
Referenced by secondsChange().
bool RTT::TimeService::Release | ( | ) | [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().
Change the time with delta seconds.
Definition at line 133 of file TimeService.cpp.
References nsecs2ticks(), ticks2nsecs(), and ticksSince().
Referenced by RTT::extras::SimulationThread::run(), and RTT::extras::SimulationThread::step().
Seconds RTT::os::TimeService::secondsGet | ( | ticks & | relativeTime | ) | const [inline] |
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 127 of file TimeService.cpp.
References ticks2nsecs(), and ticksSince().
Referenced by RTT::scripting::ConditionDSDuration::evaluate().
ticks RTT::os::TimeService::ticksGet | ( | ) | const [inline] |
Get current tick of the System clock.
Definition at line 90 of file TimeService.hpp.
ticks RTT::os::TimeService::ticksGet | ( | ticks & | relativeTime | ) | const [inline] |
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 114 of file TimeService.cpp.
References getTicks().
Referenced by RTT::scripting::ConditionDuration::evaluate(), secondsChange(), and secondsSince().