E-MailRelay
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
G::BrokenDownTime Class Reference

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
 

Detailed Description

An encapsulation of 'struct std::tm'.

Definition at line 44 of file gdatetime.h.

Constructor & Destructor Documentation

◆ BrokenDownTime() [1/2]

G::BrokenDownTime::BrokenDownTime ( const struct std::tm &  tm_in)
explicit

Constructor.

Definition at line 66 of file gdatetime.cpp.

◆ BrokenDownTime() [2/2]

G::BrokenDownTime::BrokenDownTime ( int  year,
int  month,
int  day,
int  hh,
int  mm,
int  ss 
)

Constructor.

Definition at line 154 of file gdatetime.cpp.

Member Function Documentation

◆ day()

int G::BrokenDownTime::day ( ) const

Returns the 1..31 month-day value.

Definition at line 227 of file gdatetime.cpp.

◆ epochTimeFromLocal()

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.

◆ epochTimeFromUtc()

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.

◆ format()

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.

◆ hour()

int G::BrokenDownTime::hour ( ) const

Returns the 0..23 hour value.

Definition at line 202 of file gdatetime.cpp.

◆ local()

G::BrokenDownTime G::BrokenDownTime::local ( SystemTime  t)
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.

◆ midday()

G::BrokenDownTime G::BrokenDownTime::midday ( int  year,
int  month,
int  day 
)
static

Factory function for midday on the given date.

Definition at line 168 of file gdatetime.cpp.

◆ min()

int G::BrokenDownTime::min ( ) const

Returns the 0..59 minute value.

Definition at line 207 of file gdatetime.cpp.

◆ month()

int G::BrokenDownTime::month ( ) const

Returns the 1..12 month value.

Definition at line 222 of file gdatetime.cpp.

◆ sameMinute()

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.

◆ sec()

int G::BrokenDownTime::sec ( ) const

Returns the 0..59 or 0..60 seconds value.

Definition at line 212 of file gdatetime.cpp.

◆ str() [1/2]

std::string G::BrokenDownTime::str ( ) const

Returns str() using a "%F %T" format.

Definition at line 185 of file gdatetime.cpp.

◆ str() [2/2]

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.

◆ utc()

G::BrokenDownTime G::BrokenDownTime::utc ( SystemTime  t)
static

Factory function for the utc time of the given epoch time.

See also SystemTime::utc().

Definition at line 145 of file gdatetime.cpp.

◆ wday()

int G::BrokenDownTime::wday ( ) const

Returns week day where sunday=0 and saturday=6.

Definition at line 232 of file gdatetime.cpp.

◆ year()

int G::BrokenDownTime::year ( ) const

Returns the four-digit year value.

Definition at line 217 of file gdatetime.cpp.

Friends And Related Function Documentation

◆ G::DateTimeTest

friend class G::DateTimeTest
friend

Definition at line 117 of file gdatetime.h.


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