Repesents time values. More...
#include <TimeBase.h>
Public Member Functions | |
int64_t | days () const |
Use this function if you want to express the time in days. | |
int64_t | hours () const |
int32_t | microSeconds () const |
int32_t | milliSeconds () const |
int64_t | minutes () const |
int32_t | nanoSeconds () const |
void | normalizeTime () |
bool | operator!= (const TimeBase &other) const |
TimeBase & | operator+= (const TimeBase &span) |
Adds a TimeSpan. | |
TimeBase & | operator-= (const TimeBase &span) |
Substracts a TimeSpan. | |
bool | operator< (const TimeBase &other) const |
bool | operator<= (const TimeBase &other) const |
bool | operator== (const TimeBase &other) const |
bool | operator> (const TimeBase &other) const |
bool | operator>= (const TimeBase &other) const |
int64_t | seconds () const |
struct timespec | systemTimespec () const |
int32_t | tbNSec () const |
Returns the nanosecond part of this time. | |
int64_t | tbSec () const |
Returns the second part of this time. | |
struct timespec | timespec () const |
Protected Member Functions | |
void | fromTimespec (const struct timespec &time) |
TimeBase (int64_t secs=0, int32_t nsecs=0) | |
TimeBase (const struct timespec &time) | |
Static Protected Member Functions | |
static TimeBase | maxTime () |
Protected Attributes | |
int32_t | nsecs |
int64_t | secs |
Repesents time values.
You should not use this class directly. Use the subclasses TimeStamp and TimeSpan instead.
Definition at line 59 of file TimeBase.h.
icl_core::TimeBase::TimeBase | ( | int64_t | secs = 0 , |
int32_t | nsecs = 0 |
||
) | [explicit, protected] |
Definition at line 239 of file TimeBase.cpp.
icl_core::TimeBase::TimeBase | ( | const struct timespec & | time | ) | [protected] |
Definition at line 246 of file TimeBase.cpp.
int64_t icl_core::TimeBase::days | ( | ) | const [inline] |
Use this function if you want to express the time in days.
Definition at line 107 of file TimeBase.h.
void icl_core::TimeBase::fromTimespec | ( | const struct timespec & | time | ) | [protected] |
Definition at line 253 of file TimeBase.cpp.
int64_t icl_core::TimeBase::hours | ( | ) | const [inline] |
Use this function if you want to express the time in hours, minutes and seconds.
Definition at line 115 of file TimeBase.h.
TimeBase icl_core::TimeBase::maxTime | ( | ) | [static, protected] |
Reimplemented in icl_core::TimeStamp.
Definition at line 232 of file TimeBase.cpp.
int32_t icl_core::TimeBase::microSeconds | ( | ) | const [inline] |
Use this function if you want to express the time in hours, minutes, seconds, milliseconds and microseconds.
Definition at line 147 of file TimeBase.h.
int32_t icl_core::TimeBase::milliSeconds | ( | ) | const [inline] |
Use this function if you want to express the time in hours, minutes, seconds and milliseconds.
Definition at line 139 of file TimeBase.h.
int64_t icl_core::TimeBase::minutes | ( | ) | const [inline] |
Use this function if you want to express the time in hours, minutes and seconds.
Definition at line 123 of file TimeBase.h.
int32_t icl_core::TimeBase::nanoSeconds | ( | ) | const [inline] |
Use this function if you want to express the time in hours, minutes, seconds, milliseconds, microseconds and nanoseconds.
Definition at line 155 of file TimeBase.h.
void icl_core::TimeBase::normalizeTime | ( | ) |
Normalizes this time so that the nanosecond part is between 0 and sign(sec)999999999.
Definition at line 83 of file TimeBase.cpp.
bool icl_core::TimeBase::operator!= | ( | const TimeBase & | other | ) | const |
Compares two variables of type TimeBase.
true
if they are not equal. Definition at line 53 of file TimeBase.cpp.
Adds a TimeSpan.
Definition at line 37 of file TimeBase.cpp.
Substracts a TimeSpan.
Definition at line 45 of file TimeBase.cpp.
bool icl_core::TimeBase::operator< | ( | const TimeBase & | other | ) | const |
Compares two variables of type TimeBase.
true
if the first one is earlier than the second one. Definition at line 63 of file TimeBase.cpp.
bool icl_core::TimeBase::operator<= | ( | const TimeBase & | other | ) | const |
Compares two variables of type TimeBase.
true
if the first one is earlier than or equal to the second one. Definition at line 73 of file TimeBase.cpp.
bool icl_core::TimeBase::operator== | ( | const TimeBase & | other | ) | const |
Compares two variables of type TimeBase.
true
if they are equal. Definition at line 58 of file TimeBase.cpp.
bool icl_core::TimeBase::operator> | ( | const TimeBase & | other | ) | const |
Compares two variables of type TimeBase.
true
if the first one is later than the second one. Definition at line 68 of file TimeBase.cpp.
bool icl_core::TimeBase::operator>= | ( | const TimeBase & | other | ) | const |
Compares two variables of type TimeBase.
true
if the first one is later than or equal to the second one. Definition at line 78 of file TimeBase.cpp.
int64_t icl_core::TimeBase::seconds | ( | ) | const [inline] |
Use this function if you want to express the time in hours, minutes and seconds.
Definition at line 131 of file TimeBase.h.
struct timespec icl_core::TimeBase::systemTimespec | ( | ) | const [read] |
Convert to struct timespec
. The base time for this conversion is the system clock, which may differ from the world clock on some systems.
Definition at line 121 of file TimeBase.cpp.
int32_t icl_core::TimeBase::tbNSec | ( | ) | const [inline] |
Returns the nanosecond part of this time.
Definition at line 163 of file TimeBase.h.
int64_t icl_core::TimeBase::tbSec | ( | ) | const [inline] |
Returns the second part of this time.
Definition at line 161 of file TimeBase.h.
struct timespec icl_core::TimeBase::timespec | ( | ) | const [read] |
Convert to struct timespec
. The base time for this conversion is the global clock (i.e. 0 = 1970-01-01 00:00:00).
Definition at line 113 of file TimeBase.cpp.
int32_t icl_core::TimeBase::nsecs [protected] |
Definition at line 289 of file TimeBase.h.
int64_t icl_core::TimeBase::secs [protected] |
Definition at line 288 of file TimeBase.h.