Repesents absolute times. More...
#include <TimeSpan.h>
Public Member Functions | |
TimeSpan & | fromMSec (int64_t msec) |
Set the time span to msec milliseconds. | |
TimeSpan & | fromSec (int64_t sec) |
Set the time span to sec seconds. | |
TimeSpan & | fromUSec (int64_t usec) |
Set the time span to usec microseconds. | |
bool | operator!= (const TimeSpan &other) const |
TimeSpan & | operator+= (const TimeSpan &span) |
Adds a TimeSpan. | |
TimeSpan & | operator-= (const TimeSpan &span) |
Substracts a TimeSpan. | |
bool | operator< (const TimeSpan &other) const |
bool | operator<= (const TimeSpan &other) const |
bool | operator== (const TimeSpan &other) const |
bool | operator> (const TimeSpan &other) const |
bool | operator>= (const TimeSpan &other) const |
TimeSpan (int64_t sec=0, int32_t nsec=0) | |
TimeSpan (const struct timespec &time_span) | |
Constructs a time span from a struct timespec. | |
int64_t | toMSec () const |
May result in an overflow if seconds are too large. | |
int64_t | toNSec () const |
int64_t | toUSec () const |
May result in an overflow if seconds are too large. | |
int32_t | tsNSec () const |
int64_t | tsSec () const |
int32_t | tsUSec () const |
Static Public Member Functions | |
static TimeSpan | createFromMSec (int64_t msec) |
Create a time span with msec milliseconds. | |
static TimeSpan | createFromSec (int64_t sec) |
Create a time span with sec seconds. | |
static TimeSpan | createFromUSec (int64_t usec) |
Create a time span with usec microseconds. | |
Static Public Attributes | |
static const TimeSpan | cZERO |
Friends | |
class | TimeStamp |
Repesents absolute times.
Use this class whenever you want to deal with times, as it provides a number of operators and functions.
Definition at line 46 of file TimeSpan.h.
icl_core::TimeSpan::TimeSpan | ( | int64_t | sec = 0 , |
int32_t | nsec = 0 |
||
) | [explicit] |
Constructs a time span from a second and nanosecond value.
sec | The second part of the newly constructed time span. |
nsec | The nanosecond part of the time span. |
Definition at line 34 of file TimeSpan.cpp.
icl_core::TimeSpan::TimeSpan | ( | const struct timespec & | time_span | ) |
Constructs a time span from a struct timespec.
Definition at line 38 of file TimeSpan.cpp.
TimeSpan icl_core::TimeSpan::createFromMSec | ( | int64_t | msec | ) | [static] |
Create a time span with msec milliseconds.
Definition at line 92 of file TimeSpan.cpp.
TimeSpan icl_core::TimeSpan::createFromSec | ( | int64_t | sec | ) | [static] |
Create a time span with sec seconds.
Definition at line 87 of file TimeSpan.cpp.
TimeSpan icl_core::TimeSpan::createFromUSec | ( | int64_t | usec | ) | [static] |
Create a time span with usec microseconds.
Definition at line 97 of file TimeSpan.cpp.
TimeSpan & icl_core::TimeSpan::fromMSec | ( | int64_t | msec | ) |
Set the time span to msec milliseconds.
Definition at line 71 of file TimeSpan.cpp.
TimeSpan & icl_core::TimeSpan::fromSec | ( | int64_t | sec | ) |
Set the time span to sec seconds.
Definition at line 63 of file TimeSpan.cpp.
TimeSpan & icl_core::TimeSpan::fromUSec | ( | int64_t | usec | ) |
Set the time span to usec microseconds.
Definition at line 79 of file TimeSpan.cpp.
bool icl_core::TimeSpan::operator!= | ( | const TimeSpan & | other | ) | const |
Compares two variables of type TimeSpan.
true
if they are not equal. Definition at line 118 of file TimeSpan.cpp.
Adds a TimeSpan.
Definition at line 102 of file TimeSpan.cpp.
Substracts a TimeSpan.
Definition at line 110 of file TimeSpan.cpp.
bool icl_core::TimeSpan::operator< | ( | const TimeSpan & | other | ) | const |
Compares two variables of type TimeSpan.
true
if the first one is earlier than the second one. Definition at line 128 of file TimeSpan.cpp.
bool icl_core::TimeSpan::operator<= | ( | const TimeSpan & | other | ) | const |
Compares two variables of type TimeSpan.
true
if the first one is earlier than or equal to the second one. Definition at line 138 of file TimeSpan.cpp.
bool icl_core::TimeSpan::operator== | ( | const TimeSpan & | other | ) | const |
Compares two variables of type TimeSpan.
true
if they are equal. Definition at line 123 of file TimeSpan.cpp.
bool icl_core::TimeSpan::operator> | ( | const TimeSpan & | other | ) | const |
Compares two variables of type TimeSpan.
true
if the first one is later than the second one. Definition at line 133 of file TimeSpan.cpp.
bool icl_core::TimeSpan::operator>= | ( | const TimeSpan & | other | ) | const |
Compares two variables of type TimeSpan.
true
if the first one is later than or equal to the second one. Definition at line 143 of file TimeSpan.cpp.
int64_t icl_core::TimeSpan::toMSec | ( | ) | const |
May result in an overflow if seconds are too large.
Definition at line 163 of file TimeSpan.cpp.
int64_t icl_core::TimeSpan::toNSec | ( | ) | const |
Returns the timespan as nanoseconds. The conversion may result in an overflow if the seconds are too large.
Definition at line 173 of file TimeSpan.cpp.
int64_t icl_core::TimeSpan::toUSec | ( | ) | const |
May result in an overflow if seconds are too large.
Definition at line 168 of file TimeSpan.cpp.
int32_t icl_core::TimeSpan::tsNSec | ( | ) | const |
Definition at line 153 of file TimeSpan.cpp.
int64_t icl_core::TimeSpan::tsSec | ( | ) | const |
Definition at line 148 of file TimeSpan.cpp.
int32_t icl_core::TimeSpan::tsUSec | ( | ) | const |
Definition at line 158 of file TimeSpan.cpp.
friend class TimeStamp [friend] |
Definition at line 48 of file TimeSpan.h.
const TimeSpan icl_core::TimeSpan::cZERO [static] |
Definition at line 159 of file TimeSpan.h.