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... | |
void | format (std::vector< char > &out, const char *fmt) const |
Puts the formatted date, including a terminating null character, into the given buffer. 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 |
Searches std::mktime() over the range of all timezones to convert 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 &other) const |
Returns true if this and the other broken-down times are the same, at minute resolution with no rounding. More... | |
Static Public Member Functions | |
static BrokenDownTime | midday (int year, int month, int day) |
Factory function for midday on the given date. More... | |
static BrokenDownTime | local (SystemTime) |
Factory function for the locale-dependent local time of the given epoch time. More... | |
static BrokenDownTime | utc (SystemTime) |
Factory function for the utc 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 66 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 227 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 74 of file gdatetime.cpp.
std::time_t G::BrokenDownTime::epochTimeFromUtc | ( | ) | const |
Searches std::mktime() over the range of all timezones to convert this utc broken-down time into epoch time.
Definition at line 84 of file gdatetime.cpp.
void G::BrokenDownTime::format | ( | std::vector< char > & | out, |
const char * | fmt | ||
) | const |
Puts the formatted date, including a terminating null character, into the given buffer.
Only simple non-locale-dependent format specifiers are allowed, and these allowed specifiers explicitly exclude 'z' and 'Z'.
Definition at line 173 of file gdatetime.cpp.
int G::BrokenDownTime::hour | ( | ) | const |
Returns the 0..23 hour value.
Definition at line 202 of file gdatetime.cpp.
|
static |
Factory function for the locale-dependent local time of the given epoch time.
See also SystemTime::local().
Definition at line 136 of file gdatetime.cpp.
|
static |
Factory function for midday on the given date.
Definition at line 168 of file gdatetime.cpp.
int G::BrokenDownTime::min | ( | ) | const |
Returns the 0..59 minute value.
Definition at line 207 of file gdatetime.cpp.
int G::BrokenDownTime::month | ( | ) | const |
Returns the 1..12 month value.
Definition at line 222 of file gdatetime.cpp.
bool G::BrokenDownTime::sameMinute | ( | const BrokenDownTime & | other | ) | const |
Returns true if this and the other broken-down times are the same, at minute resolution with no rounding.
Definition at line 237 of file gdatetime.cpp.
int G::BrokenDownTime::sec | ( | ) | const |
Returns the 0..59 or 0..60 seconds value.
Definition at line 212 of file gdatetime.cpp.
std::string G::BrokenDownTime::str | ( | ) | const |
Returns str() using a "%F %T" format.
Definition at line 185 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 190 of file gdatetime.cpp.
|
static |
Factory function for the utc time of the given epoch time.
See also SystemTime::utc().
Definition at line 145 of file gdatetime.cpp.
int G::BrokenDownTime::wday | ( | ) | const |
Returns week day where sunday=0 and saturday=6.
Definition at line 232 of file gdatetime.cpp.
int G::BrokenDownTime::year | ( | ) | const |
Returns the four-digit year value.
Definition at line 217 of file gdatetime.cpp.
|
friend |
Definition at line 117 of file gdatetime.h.