E-MailRelay

Classes | Public Member Functions | Static Public Member Functions | List of all members
G::Time Class Reference

A simple time-of-day (hh/mm/ss) class. More...

`#include <gtime.h>`

## Classes
class | LocalTime
| An overload discriminator class for Time constructors. More...

## Public Member Functions
| Time ()
| Constructor for the current time, using UTC. More...
| Time (int hh, int mm, int ss)
| Constructor for the given time. More...
| Time (const BrokenDownTime &tm)
| Constructor for the given broken-down time. More...
| Time (SystemTime t)
| Constructor for the given epoch time, using UTC. More...
| Time (SystemTime t, const LocalTime &)
| Constructor for the given epoch time, using the local timezone. More...
| Time (const LocalTime &)
| Constructor for the current time, using the local timezone. More...
int | hours () const
| Returns the hours (0 <= h < 24). More...
int | minutes () const
| Returns the minutes (0 <= m < 60). More...
int | seconds () const
| Returns the seconds (0 <= s <= 61). More...
std::string | hhmmss (const char *sep=nullptr) const
| Returns the hhmmss string. More...
std::string | hhmm (const char *sep=nullptr) const
| Returns the hhmm string. More...
std::string | ss () const
| Returns the seconds as a two-digit decimal string. More...
unsigned int | value () const
| Returns the time as the number of seconds since midnight (ignoring leap seconds). More...
bool | operator== (const Time &) const
| Comparison operator. More...
bool | operator!= (const Time &) const
| Comparison operator. More...

## Static Public Member Functions
static Time | at (unsigned int)
| Factory function for a time that is the given number of seconds since midnight (see value()). More...

## Detailed Description

A simple time-of-day (hh/mm/ss) class.

See also
  G::Date, G::DateTime

Definition at line 38 of file gtime.h.

## Constructor & Destructor Documentation

## ◆ Time() [1/6]

G::Time::Time | ( |  | ) |

Constructor for the current time, using UTC.

Definition at line 41 of file gtime.cpp.

## ◆ Time() [2/6]

G::Time::Time | ( | int | hh,
|  | int | mm,
|  | int | ss
| ) |  |

Constructor for the given time.

Out-of-range values are clamped, with leap seconds allowed only just before midnight.

Definition at line 27 of file gtime.cpp.

## ◆ Time() [3/6]

G::Time::Time | ( | const BrokenDownTime & | tm | ) |
| explicit

Constructor for the given broken-down time.

Definition at line 34 of file gtime.cpp.

## ◆ Time() [4/6]

G::Time::Time | ( | SystemTime | t | ) |
| explicit

Constructor for the given epoch time, using UTC.

Definition at line 46 of file gtime.cpp.

## ◆ Time() [5/6]

G::Time::Time | ( | SystemTime | t,
|  | const LocalTime & |
| ) |  |

Constructor for the given epoch time, using the local timezone.

Definition at line 56 of file gtime.cpp.

## ◆ Time() [6/6]

G::Time::Time | ( | const LocalTime & |  | ) |
| explicit

Constructor for the current time, using the local timezone.

Definition at line 51 of file gtime.cpp.

## Member Function Documentation

## ◆ at()

G::Time G::Time::at | ( | unsigned int | s | ) |
| static

Factory function for a time that is the given number of seconds since midnight (see value()).

Values that are out of the normal time-of-day range are clamped, with leap seconds beging lost in the process.

Definition at line 107 of file gtime.cpp.

## ◆ hhmm()

std::string G::Time::hhmm | ( | const char * | sep = `nullptr` | ) | const

Returns the hhmm string.

Definition at line 84 of file gtime.cpp.

## ◆ hhmmss()

std::string G::Time::hhmmss | ( | const char * | sep = `nullptr` | ) | const

Returns the hhmmss string.

Definition at line 76 of file gtime.cpp.

## ◆ hours()

int G::Time::hours | ( |  | ) | const

Returns the hours (0 <= h < 24).

Definition at line 61 of file gtime.cpp.

## ◆ minutes()

int G::Time::minutes | ( |  | ) | const

Returns the minutes (0 <= m < 60).

Definition at line 66 of file gtime.cpp.

## ◆ operator!=()

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

Comparison operator.

Definition at line 122 of file gtime.cpp.

## ◆ operator==()

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

Comparison operator.

Definition at line 117 of file gtime.cpp.

## ◆ seconds()

int G::Time::seconds | ( |  | ) | const

Returns the seconds (0 <= s <= 61).

Definition at line 71 of file gtime.cpp.

## ◆ ss()

std::string G::Time::ss | ( |  | ) | const

Returns the seconds as a two-digit decimal string.

Definition at line 92 of file gtime.cpp.

## ◆ value()

unsigned int G::Time::value | ( |  | ) | const

Returns the time as the number of seconds since midnight (ignoring leap seconds).

Definition at line 99 of file gtime.cpp.

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

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