E-MailRelay
|
Represents a unix-epoch time with microsecond resolution. More...
#include <gdatetime.h>
Public Member Functions | |
SystemTime (std::time_t, unsigned long us=0UL) noexcept | |
Constructor. More... | |
bool | isZero () const |
Returns true if zero(). More... | |
bool | sameSecond (const SystemTime &other) const noexcept |
Returns true if this time and the other time are the same, at second resolution. More... | |
BrokenDownTime | local () const |
Returns the locale-dependent local broken-down time. More... | |
BrokenDownTime | utc () const |
Returns the utc broken-down time. More... | |
unsigned int | ms () const |
Returns the millisecond fraction. More... | |
unsigned int | us () const |
Returns the microsecond fraction. More... | |
std::time_t | s () const noexcept |
Returns the number of seconds since the start of the epoch. More... | |
bool | operator< (const SystemTime &) const |
Comparison operator. More... | |
bool | operator<= (const SystemTime &) const |
Comparison operator. More... | |
bool | operator== (const SystemTime &) const |
Comparison operator. More... | |
bool | operator!= (const SystemTime &) const |
Comparison operator. More... | |
bool | operator> (const SystemTime &) const |
Comparison operator. More... | |
bool | operator>= (const SystemTime &) const |
Comparison operator. More... | |
void | operator+= (TimeInterval) |
Adds the given interval. Throws on overflow. More... | |
SystemTime | operator+ (TimeInterval) const |
Returns this time with given interval added. More... | |
TimeInterval | operator- (const SystemTime &start) const |
Returns the given start time's interval() compared to this end time. More... | |
TimeInterval | interval (const SystemTime &end) const |
Returns the interval between this time and the given end time. More... | |
void | streamOut (std::ostream &) const |
Streams out the time comprised of the s() value, a decimal point, and then the six-digit us() value. More... | |
Static Public Member Functions | |
static SystemTime | now () |
Factory function for the current time. More... | |
static SystemTime | zero () |
Factory function for the start of the epoch. More... | |
Friends | |
class | G::DateTimeTest |
Represents a unix-epoch time with microsecond resolution.
Definition at line 139 of file gdatetime.h.
|
explicitnoexcept |
Constructor.
The first parameter should be some large positive number. The second parameter can be more than 10^6.
Definition at line 322 of file gdatetime.cpp.
G::TimeInterval G::SystemTime::interval | ( | const SystemTime & | end | ) | const |
Returns the interval between this time and the given end time.
Returns TimeInterval::zero() on underflow or TimeInterval::limit() on overflow of TimeInterval::s_type.
Definition at line 338 of file gdatetime.cpp.
bool G::SystemTime::isZero | ( | ) | const |
Returns true if zero().
Definition at line 397 of file gdatetime.cpp.
G::BrokenDownTime G::SystemTime::local | ( | ) | const |
Returns the locale-dependent local broken-down time.
Definition at line 356 of file gdatetime.cpp.
unsigned int G::SystemTime::ms | ( | ) | const |
Returns the millisecond fraction.
Definition at line 367 of file gdatetime.cpp.
|
static |
Factory function for the current time.
Definition at line 328 of file gdatetime.cpp.
bool G::SystemTime::operator!= | ( | const SystemTime & | other | ) | const |
Comparison operator.
Definition at line 420 of file gdatetime.cpp.
G::SystemTime G::SystemTime::operator+ | ( | TimeInterval | interval | ) | const |
Returns this time with given interval added.
Throws on overflow.
Definition at line 440 of file gdatetime.cpp.
void G::SystemTime::operator+= | ( | TimeInterval | i | ) |
Adds the given interval. Throws on overflow.
Definition at line 448 of file gdatetime.cpp.
G::TimeInterval G::SystemTime::operator- | ( | const SystemTime & | start | ) | const |
Returns the given start time's interval() compared to this end time.
Returns TimeInterval::zero() on underflow or TimeInterval::limit() on overflow of TimeInterval::s_type.
Definition at line 333 of file gdatetime.cpp.
bool G::SystemTime::operator< | ( | const SystemTime & | other | ) | const |
Comparison operator.
Definition at line 403 of file gdatetime.cpp.
bool G::SystemTime::operator<= | ( | const SystemTime & | other | ) | const |
Comparison operator.
Definition at line 409 of file gdatetime.cpp.
bool G::SystemTime::operator== | ( | const SystemTime & | other | ) | const |
Comparison operator.
Definition at line 415 of file gdatetime.cpp.
bool G::SystemTime::operator> | ( | const SystemTime & | other | ) | const |
Comparison operator.
Definition at line 426 of file gdatetime.cpp.
bool G::SystemTime::operator>= | ( | const SystemTime & | other | ) | const |
Comparison operator.
Definition at line 433 of file gdatetime.cpp.
|
noexcept |
Returns the number of seconds since the start of the epoch.
Definition at line 380 of file gdatetime.cpp.
|
noexcept |
Returns true if this time and the other time are the same, at second resolution.
Definition at line 351 of file gdatetime.cpp.
void G::SystemTime::streamOut | ( | std::ostream & | stream | ) | const |
Streams out the time comprised of the s() value, a decimal point, and then the six-digit us() value.
Definition at line 455 of file gdatetime.cpp.
unsigned int G::SystemTime::us | ( | ) | const |
Returns the microsecond fraction.
Definition at line 374 of file gdatetime.cpp.
G::BrokenDownTime G::SystemTime::utc | ( | ) | const |
Returns the utc broken-down time.
Definition at line 361 of file gdatetime.cpp.
|
static |
Factory function for the start of the epoch.
Definition at line 388 of file gdatetime.cpp.
|
friend |
Definition at line 216 of file gdatetime.h.