C++ TargetRTS
|
A time value which can represent either an absolute or relative time. More...
#include <RTTimespec.h>
Public Member Functions | |
RTTimespec (void) | |
Construct a zero time value. | |
RTTimespec (long s, long ns) | |
Construct a new time value. | |
RTTimespec (const RTInterval &) | |
RTTimespec (const RTTime &) | |
RTTimespec (const RTTimespec &) | |
void | normalize (void) |
Normalize the time value so that as many seconds as possible are stored in the tv_sec field and remaining nanoseconds in the tv_nsec field. | |
RTTimespec & | operator= (const RTTimespec &) |
RTTimespec & | operator+= (const RTTimespec &) |
RTTimespec & | operator-= (const RTTimespec &) |
long | ticksFromNow (long nanoseconds_per_tick) const |
Get the number of "ticks" which is between this time value and the current time. | |
Static Public Member Functions | |
static void | getclock (RTTimespec &tspec) |
Get the current time. | |
Public Attributes | |
long | tv_sec |
Seconds. | |
long | tv_nsec |
Nanoseconds. | |
Static Public Attributes | |
static const RTTimespec | zero |
Static constant for a zero time value. | |
static const RTObject_class | classData |
Type descriptor for an RTTimespec. | |
A time value which can represent either an absolute or relative time.
For an absolute time the representation uses Unix time, i.e. the number of seconds and nanoseconds that have passed since 1 January 1970.
RTTimespec::RTTimespec | ( | long | s, |
long | ns | ||
) |
Construct a new time value.
[in] | s | Number of seconds |
[in] | ns | Number of nanoseconds |
|
static |
Get the current time.
[out] | tspec | RTTimespec object to write the current time to. |
void RTTimespec::normalize | ( | void | ) |
Normalize the time value so that as many seconds as possible are stored in the tv_sec field and remaining nanoseconds in the tv_nsec field.
After calling this function it's guaranteed that tv_nsec < 1000000000.
long RTTimespec::ticksFromNow | ( | long | nanoseconds_per_tick | ) | const |
Get the number of "ticks" which is between this time value and the current time.
[in] | nanoseconds_per_tick | Defines the length of a "tick" in nanoseconds |