Repesents absolute times. More...
#include <TimeSpan.h>
Public Member Functions | |
TimeSpan & | fromMSec (int64_t msec) |
Set the time span to msec milliseconds. More... | |
TimeSpan & | fromSec (int64_t sec) |
Set the time span to sec seconds. More... | |
TimeSpan & | fromUSec (int64_t usec) |
Set the time span to usec microseconds. More... | |
bool | operator!= (const TimeSpan &other) const |
TimeSpan & | operator+= (const TimeSpan &span) |
Adds a TimeSpan. More... | |
TimeSpan & | operator-= (const TimeSpan &span) |
Substracts a TimeSpan. More... | |
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. More... | |
int64_t | toMSec () const |
May result in an overflow if seconds are too large. More... | |
int64_t | toNSec () const |
int64_t | toUSec () const |
May result in an overflow if seconds are too large. More... | |
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. More... | |
static TimeSpan | createFromSec (int64_t sec) |
Create a time span with sec seconds. More... | |
static TimeSpan | createFromUSec (int64_t usec) |
Create a time span with usec microseconds. More... | |
Static Public Attributes | |
static const TimeSpan | cZERO |
Friends | |
class | TimeStamp |
Additional Inherited Members | |
Protected Member Functions inherited from icl_core::TimeBase | |
void | fromTimespec (const struct timespec &time) |
TimeBase (int64_t secs=0, int32_t nsecs=0) | |
TimeBase (const struct timespec &time) | |
int64_t | days () const |
Use this function if you want to express the time in days. More... | |
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. More... | |
TimeBase & | operator-= (const TimeBase &span) |
Substracts a TimeSpan. More... | |
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. More... | |
int64_t | tbSec () const |
Returns the second part of this time. More... | |
struct timespec | timespec () const |
Static Protected Member Functions inherited from icl_core::TimeBase | |
static TimeBase | maxTime () |
Protected Attributes inherited from icl_core::TimeBase | |
int32_t | nsecs |
int64_t | secs |
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.
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.
Create a time span with msec milliseconds.
Definition at line 92 of file TimeSpan.cpp.
Create a time span with sec seconds.
Definition at line 87 of file TimeSpan.cpp.
Create a time span with usec microseconds.
Definition at line 97 of file TimeSpan.cpp.
Set the time span to msec milliseconds.
Definition at line 71 of file TimeSpan.cpp.
Set the time span to sec seconds.
Definition at line 63 of file TimeSpan.cpp.
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 |
Definition at line 48 of file TimeSpan.h.
|
static |
Definition at line 159 of file TimeSpan.h.