E-MailRelay
|
An encapsulation of 'struct std::tm'. More...
#include <gdatetime.h>
Public Member Functions | |
BrokenDownTime (const struct std::tm &) | |
Constructor. More... | |
BrokenDownTime (int year, int month, int day, int hh, int mm, int ss) | |
Constructor. More... | |
bool | format (char *out, std::size_t out_size, const char *fmt) const |
Puts the formatted date, including a terminating null character, into the given output buffer. More... | |
void | format (std::vector< char > &out, const char *fmt) const |
Overload for an output vector. More... | |
std::string | str (const char *fmt) const |
Returns the formatted date, with the same restrictions as format(). More... | |
std::string | str () const |
Returns str() using a "%F %T" format. More... | |
int | year () const |
Returns the four-digit year value. More... | |
int | month () const |
Returns the 1..12 month value. More... | |
int | day () const |
Returns the 1..31 month-day value. More... | |
int | hour () const |
Returns the 0..23 hour value. More... | |
int | min () const |
Returns the 0..59 minute value. More... | |
int | sec () const |
Returns the 0..59 or 0..60 seconds value. More... | |
int | wday () const |
Returns week day where sunday=0 and saturday=6. More... | |
std::time_t | epochTimeFromUtc () const |
Converts this utc broken-down time into epoch time. More... | |
std::time_t | epochTimeFromLocal () const |
Uses std::mktime() to convert this locale-dependent local broken-down time into epoch time. More... | |
bool | sameMinute (const BrokenDownTime &) const noexcept |
Returns true if this and the other broken-down times are the same, at minute resolution with no rounding. More... | |
bool | operator== (const BrokenDownTime &) const noexcept |
Equality test. More... | |
bool | operator!= (const BrokenDownTime &) const noexcept |
Inequality test. More... | |
Static Public Member Functions | |
static BrokenDownTime | null () |
Factory function for an unusable object with bogus component values. More... | |
static BrokenDownTime | midday (int year, int month, int day) |
Factory function for midday on the given date. More... | |
static BrokenDownTime | midnight (int year, int month, int day) |
Factory function for midnight starting the given date. More... | |
static BrokenDownTime | local (SystemTime) |
Factory function for the locale-dependent local broken-down time of the given epoch time. More... | |
static BrokenDownTime | utc (SystemTime) |
Factory function for the utc broken-down time of the given epoch time. More... | |
Friends | |
class | G::DateTimeTest |
An encapsulation of 'struct std::tm'.
Definition at line 44 of file gdatetime.h.
|
explicit |
Constructor.
Definition at line 145 of file gdatetime.cpp.
G::BrokenDownTime::BrokenDownTime | ( | int | year, |
int | month, | ||
int | day, | ||
int | hh, | ||
int | mm, | ||
int | ss | ||
) |
Constructor.
Definition at line 154 of file gdatetime.cpp.
int G::BrokenDownTime::day | ( | ) | const |
Returns the 1..31 month-day value.
Definition at line 296 of file gdatetime.cpp.
std::time_t G::BrokenDownTime::epochTimeFromLocal | ( | ) | const |
Uses std::mktime() to convert this locale-dependent local broken-down time into epoch time.
Definition at line 169 of file gdatetime.cpp.
std::time_t G::BrokenDownTime::epochTimeFromUtc | ( | ) | const |
Converts this utc broken-down time into epoch time.
Definition at line 175 of file gdatetime.cpp.
bool G::BrokenDownTime::format | ( | char * | out, |
std::size_t | out_size, | ||
const char * | fmt | ||
) | const |
Puts the formatted date, including a terminating null character, into the given output buffer.
Returns false if the output buffer is too small. Only simple non-locale-dependent format specifiers are allowed, and these allowed specifiers explicitly exclude 'z' and 'Z'.
Definition at line 232 of file gdatetime.cpp.
void G::BrokenDownTime::format | ( | std::vector< char > & | out, |
const char * | fmt | ||
) | const |
Overload for an output vector.
Throws if the vector is too small for the result (with its null terminator).
Definition at line 246 of file gdatetime.cpp.
int G::BrokenDownTime::hour | ( | ) | const |
Returns the 0..23 hour value.
Definition at line 271 of file gdatetime.cpp.
|
static |
Factory function for the locale-dependent local broken-down time of the given epoch time.
See also SystemTime::local().
Definition at line 206 of file gdatetime.cpp.
|
static |
Factory function for midday on the given date.
Definition at line 220 of file gdatetime.cpp.
|
static |
Factory function for midnight starting the given date.
Definition at line 226 of file gdatetime.cpp.
int G::BrokenDownTime::min | ( | ) | const |
Returns the 0..59 minute value.
Definition at line 276 of file gdatetime.cpp.
int G::BrokenDownTime::month | ( | ) | const |
Returns the 1..12 month value.
Definition at line 291 of file gdatetime.cpp.
|
static |
Factory function for an unusable object with bogus component values.
Definition at line 200 of file gdatetime.cpp.
|
inlinenoexcept |
Inequality test.
Definition at line 422 of file gdatetime.h.
|
inlinenoexcept |
Equality test.
Definition at line 417 of file gdatetime.h.
|
noexcept |
Returns true if this and the other broken-down times are the same, at minute resolution with no rounding.
Definition at line 309 of file gdatetime.cpp.
int G::BrokenDownTime::sec | ( | ) | const |
Returns the 0..59 or 0..60 seconds value.
Definition at line 281 of file gdatetime.cpp.
std::string G::BrokenDownTime::str | ( | ) | const |
Returns str() using a "%F %T" format.
Definition at line 253 of file gdatetime.cpp.
std::string G::BrokenDownTime::str | ( | const char * | fmt | ) | const |
Returns the formatted date, with the same restrictions as format().
Definition at line 259 of file gdatetime.cpp.
|
static |
Factory function for the utc broken-down time of the given epoch time.
See also SystemTime::utc().
Definition at line 213 of file gdatetime.cpp.
int G::BrokenDownTime::wday | ( | ) | const |
Returns week day where sunday=0 and saturday=6.
Definition at line 301 of file gdatetime.cpp.
int G::BrokenDownTime::year | ( | ) | const |
Returns the four-digit year value.
Definition at line 286 of file gdatetime.cpp.
|
friend |
Definition at line 132 of file gdatetime.h.