E-MailRelay

Public Member Functions | Static Public Member Functions | Friends | List of all members
G::SystemTime Class Reference

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 | 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

## Detailed Description

Represents a unix-epoch time with microsecond resolution.

Definition at line 124 of file gdatetime.h.

## Constructor & Destructor Documentation

## ◆ SystemTime()

G::SystemTime::SystemTime | ( | std::time_t | t,
|  | unsigned long | us = `0UL`
| ) |  |
| explicit noexcept

Constructor.

The first parameter should be some large positive number. The second parameter can be more than 10^6.

Definition at line 254 of file gdatetime.cpp.

## Member Function Documentation

## ◆ interval()

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 270 of file gdatetime.cpp.

## ◆ local()

G::BrokenDownTime G::SystemTime::local | ( |  | ) | const

Returns the locale-dependent local broken-down time.

Definition at line 286 of file gdatetime.cpp.

## ◆ ms()

unsigned int G::SystemTime::ms | ( |  | ) | const

Returns the millisecond fraction.

Definition at line 296 of file gdatetime.cpp.

## ◆ now()

G::SystemTime G::SystemTime::now | ( |  | ) |
| static

Factory function for the current time.

Definition at line 260 of file gdatetime.cpp.

## ◆ operator!=()

bool G::SystemTime::operator!= | ( | const SystemTime & | other | ) | const

Comparison operator.

Definition at line 337 of file gdatetime.cpp.

## ◆ operator+()

G::SystemTime G::SystemTime::operator+ | ( | TimeInterval | interval | ) | const

Returns this time with given interval added.

Throws on overflow.

Definition at line 352 of file gdatetime.cpp.

## ◆ operator+=()

void G::SystemTime::operator+= | ( | TimeInterval | i | ) |

Adds the given interval. Throws on overflow.

Definition at line 359 of file gdatetime.cpp.

## ◆ operator-()

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 265 of file gdatetime.cpp.

## ◆ operator<()

bool G::SystemTime::operator< | ( | const SystemTime & | other | ) | const

Comparison operator.

Definition at line 322 of file gdatetime.cpp.

## ◆ operator<=()

bool G::SystemTime::operator<= | ( | const SystemTime & | other | ) | const

Comparison operator.

Definition at line 327 of file gdatetime.cpp.

## ◆ operator==()

bool G::SystemTime::operator== | ( | const SystemTime & | other | ) | const

Comparison operator.

Definition at line 332 of file gdatetime.cpp.

## ◆ operator>()

bool G::SystemTime::operator> | ( | const SystemTime & | other | ) | const

Comparison operator.

Definition at line 342 of file gdatetime.cpp.

## ◆ operator>=()

bool G::SystemTime::operator>= | ( | const SystemTime & | other | ) | const

Comparison operator.

Definition at line 347 of file gdatetime.cpp.

## ◆ s()

std::time_t G::SystemTime::s | ( |  | ) | const
| noexcept

Returns the number of seconds since the start of the epoch.

Definition at line 308 of file gdatetime.cpp.

## ◆ sameSecond()

bool G::SystemTime::sameSecond | ( | const SystemTime & | other | ) | const
| noexcept

Returns true if this time and the other time are the same, at second resolution.

Definition at line 281 of file gdatetime.cpp.

## ◆ streamOut()

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 366 of file gdatetime.cpp.

## ◆ us()

unsigned int G::SystemTime::us | ( |  | ) | const

Returns the microsecond fraction.

Definition at line 302 of file gdatetime.cpp.

## ◆ utc()

G::BrokenDownTime G::SystemTime::utc | ( |  | ) | const

Returns the utc broken-down time.

Definition at line 291 of file gdatetime.cpp.

## ◆ zero()

G::SystemTime G::SystemTime::zero | ( |  | ) |
| static

Factory function for the start of the epoch.

Definition at line 315 of file gdatetime.cpp.

## Friends And Related Function Documentation

## ◆ G::DateTimeTest

friend class G::DateTimeTest
| friend

Definition at line 198 of file gdatetime.h.

The documentation for this class was generated from the following files:

- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/glib/gdatetime.h
- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/glib/gdatetime.cpp