Represents absolute times. More...
#include <TimeStamp.h>
Public Member Functions | |
String | formatIso8601 () const |
String | formatIso8601Basic () const |
String | formatIso8601BasicUTC () const |
String | formatIso8601UTC () const |
TimeStamp & | fromNow () |
Set the timestamp to the current system time. | |
bool | operator!= (const TimeStamp &other) const |
TimeStamp & | operator+= (const TimeSpan &span) |
Adds a TimeSpan. | |
TimeStamp & | operator-= (const TimeSpan &span) |
Substracts a TimeSpan. | |
bool | operator< (const TimeStamp &other) const |
bool | operator<= (const TimeStamp &other) const |
bool | operator== (const TimeStamp &other) const |
bool | operator> (const TimeStamp &other) const |
bool | operator>= (const TimeStamp &other) const |
void | strfLocaltime (char *dest, size_t max_len, const char *format) const |
void | strfTime (char *dest, size_t max_len, const char *format) const |
TimeStamp () | |
Standard constructor, creates a null time. | |
TimeStamp (uint64_t sec, uint32_t nsec) | |
Constructor, takes a timeval for creation. | |
TimeStamp (const struct timespec &ts) | |
TimeStamp (time_t timestamp) | |
uint32_t | tsNSec () const |
uint64_t | tsSec () const |
uint32_t | tsUSec () const |
Static Public Member Functions | |
static TimeStamp | fromIso8601BasicUTC (const String &str) |
static TimeStamp | futureMSec (uint64_t msec) |
Returns a time stamp which lies msec ms in the future. | |
static TimeStamp | maxTime () |
static TimeStamp | now () |
Static Public Attributes | |
static const TimeStamp | cZERO |
Private Member Functions | |
TimeStamp & | operator+= (const TimeStamp &other) |
TimeStamp (const TimeBase &base) |
Represents absolute times.
Use this class whenever you want to deal with times, as it provides a number of useful operators and functions.
Definition at line 61 of file TimeStamp.h.
icl_core::TimeStamp::TimeStamp | ( | ) | [inline] |
Standard constructor, creates a null time.
Definition at line 65 of file TimeStamp.h.
icl_core::TimeStamp::TimeStamp | ( | uint64_t | sec, |
uint32_t | nsec | ||
) | [inline] |
Constructor, takes a timeval for creation.
Constructor that gets a time in seconds plus nanoseconds.
Definition at line 73 of file TimeStamp.h.
icl_core::TimeStamp::TimeStamp | ( | const struct timespec & | ts | ) | [inline] |
Definition at line 77 of file TimeStamp.h.
icl_core::TimeStamp::TimeStamp | ( | time_t | timestamp | ) | [inline, explicit] |
Definition at line 81 of file TimeStamp.h.
icl_core::TimeStamp::TimeStamp | ( | const TimeBase & | base | ) | [inline, private] |
Definition at line 335 of file TimeStamp.h.
String icl_core::TimeStamp::formatIso8601 | ( | ) | const |
Return the TimeStamp as a string in ISO 8601 format, in the local timezone.
Definition at line 221 of file TimeStamp.cpp.
Return the TimeStamp as a string in the ISO 8601 basic format (YYYYMMDDTHHMMSS,fffffffff), in the local timezone.
Definition at line 235 of file TimeStamp.cpp.
Return the TimeStamp as a string in the ISO 8601 basic format (YYYYMMDDTHHMMSS,fffffffff), in UTC.
Definition at line 249 of file TimeStamp.cpp.
String icl_core::TimeStamp::formatIso8601UTC | ( | ) | const |
Return the TimeStamp as a string in ISO 8601 format, in UTC.
Definition at line 228 of file TimeStamp.cpp.
TimeStamp icl_core::TimeStamp::fromIso8601BasicUTC | ( | const String & | str | ) | [static] |
Returns a time stamp parsed from an ISO 8601 basic UTC timestamp (YYYYMMDDTHHMMSS,fffffffff).
Definition at line 125 of file TimeStamp.cpp.
Set the timestamp to the current system time.
Definition at line 195 of file TimeStamp.cpp.
TimeStamp icl_core::TimeStamp::futureMSec | ( | uint64_t | msec | ) | [static] |
Returns a time stamp which lies msec ms in the future.
Definition at line 118 of file TimeStamp.cpp.
static TimeStamp icl_core::TimeStamp::maxTime | ( | ) | [inline, static] |
Reimplemented from icl_core::TimeBase.
Definition at line 285 of file TimeStamp.h.
TimeStamp icl_core::TimeStamp::now | ( | ) | [static] |
This static function returns a TimeStamp that contains the current System time (as UTC).
Definition at line 111 of file TimeStamp.cpp.
bool icl_core::TimeStamp::operator!= | ( | const TimeStamp & | other | ) | const [inline] |
Compares two variables of type TimeStamp.
true
if they are not equal. Definition at line 233 of file TimeStamp.h.
Adds a TimeSpan.
Definition at line 213 of file TimeStamp.h.
Definition at line 327 of file TimeStamp.cpp.
Substracts a TimeSpan.
Definition at line 222 of file TimeStamp.h.
bool icl_core::TimeStamp::operator< | ( | const TimeStamp & | other | ) | const [inline] |
Compares two variables of type TimeStamp.
true
if the first one is earlier than the second one. Definition at line 250 of file TimeStamp.h.
bool icl_core::TimeStamp::operator<= | ( | const TimeStamp & | other | ) | const [inline] |
Compares two variables of type TimeStamp.
true
if the first one is earlier than or equal to the second one. Definition at line 267 of file TimeStamp.h.
bool icl_core::TimeStamp::operator== | ( | const TimeStamp & | other | ) | const [inline] |
Compares two variables of type TimeStamp.
true
if they are equal. Definition at line 241 of file TimeStamp.h.
bool icl_core::TimeStamp::operator> | ( | const TimeStamp & | other | ) | const [inline] |
Compares two variables of type TimeStamp.
true
if the first one is later than the second one. Definition at line 258 of file TimeStamp.h.
bool icl_core::TimeStamp::operator>= | ( | const TimeStamp & | other | ) | const [inline] |
Compares two variables of type TimeStamp.
true
if the first one is later than or equal to the second one. Definition at line 276 of file TimeStamp.h.
void icl_core::TimeStamp::strfLocaltime | ( | char * | dest, |
size_t | max_len, | ||
const char * | format | ||
) | const |
Return a formatted time string converted to the local timezone.
Definition at line 211 of file TimeStamp.cpp.
void icl_core::TimeStamp::strfTime | ( | char * | dest, |
size_t | max_len, | ||
const char * | format | ||
) | const |
Return a formatted time string.
Definition at line 203 of file TimeStamp.cpp.
uint32_t icl_core::TimeStamp::tsNSec | ( | ) | const [inline] |
Definition at line 283 of file TimeStamp.h.
uint64_t icl_core::TimeStamp::tsSec | ( | ) | const [inline] |
Definition at line 281 of file TimeStamp.h.
uint32_t icl_core::TimeStamp::tsUSec | ( | ) | const [inline] |
Definition at line 282 of file TimeStamp.h.
const TimeStamp icl_core::TimeStamp::cZERO [static] |
Definition at line 332 of file TimeStamp.h.