Orocos Real-Time Toolkit  2.5.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
RTT::os::TimeService Class Reference

The TimeService is used for system-wide time keeping and conversions. More...

#include <rtt/os/TimeService.hpp>

List of all members.

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 TimeServiceInstance ()
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.

Detailed Description

The TimeService is used for system-wide time keeping and conversions.

Definition at line 35 of file TimeService.hpp.


Member Function Documentation

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().

Get current nsecs of the System clock.

Returns:
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().

Get nsecs passed since a certain moment.

Returns:
nsecs passed since relativeTime unless relativeTime is zero, then sets relativeTime = timeGet() and returns zero

Definition at line 146 of file TimeService.cpp.

References getNSecs().

Get the time in seconds passed since a certain moment.

Returns:
seconds passed since relativeTime unless relativeTime is zero, then sets relativeTime = timeGet() and returns zero

Definition at line 121 of file TimeService.cpp.

References getTicks(), and ticks2nsecs().

Get current tick of the System clock.

Returns:
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().

Get clicks passed since a certain moment.

Returns:
ticks passed since relativeTime unless relativeTime is zero, then sets relativeTime = timeGet() and returns zero

Definition at line 103 of file TimeService.cpp.

References getTicks().

Convert an amount of nano seconds to System ticks.

Parameters:
mThe amount of nano seconds
Returns:
The equivalent in ticks

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.

Returns:
true on success, false on failure

Definition at line 52 of file TimeService.cpp.

Referenced by __os_exit().

Change the time with delta seconds.

Returns:
the new time.

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.

Returns:
seconds passed since relativeTime unless relativeTime is zero, then sets relativeTime = timeGet() and returns zero
Deprecated:
by getSeconds()

Definition at line 133 of file TimeService.hpp.

Get Seconds passed since a certain moment.

If relativeTime is zero, the absolute syteme time is given.

Returns:
Seconds passed since relativeTime.

Definition at line 127 of file TimeService.cpp.

References ticks2nsecs(), and ticksSince().

Referenced by RTT::scripting::ConditionDSDuration::evaluate().

Get current tick of the System clock.

Returns:
current tick of the system clock
Deprecated:
by getTicks()

Definition at line 90 of file TimeService.hpp.

ticks RTT::os::TimeService::ticksGet ( ticks relativeTime) const [inline]

Get clicks passed since a certain moment.

Returns:
ticks passed since relativeTime unless relativeTime is zero, then sets relativeTime = timeGet() and returns zero
Deprecated:
by getTicks()

Definition at line 106 of file TimeService.hpp.

Get clicks passed since a certain moment.

If relativeTime is zero, the absolute system time is given.

Returns:
ticks passed since relativeTime.

Definition at line 114 of file TimeService.cpp.

References getTicks().

Referenced by RTT::scripting::ConditionDuration::evaluate(), secondsChange(), and secondsSince().


The documentation for this class was generated from the following files: