Public Types | Static Public Member Functions | List of all members
G::DateTime Class Reference

A low-level static class used by Date and Time. More...

#include <gdatetime.h>

Public Types

typedef std::time_t EpochTime
 
typedef struct std::tm BrokenDownTime
 
typedef std::pair< bool,
unsigned int > 
Offset
 

Static Public Member Functions

static EpochTime now ()
 Returns the current epoch time. More...
 
static EpochTime epochTime (const BrokenDownTime &broken_down_time)
 Converts from UTC broken-down-time to epoch time. More...
 
static BrokenDownTime utc (EpochTime epoch_time)
 Converts from epoch time to UTC broken-down-time. More...
 
static BrokenDownTime local (EpochTime epoch_time)
 Converts from epoch time to local broken-down-time. More...
 
static Offset offset (EpochTime epoch_time)
 Returns the offset between UTC and localtime as at 'epoch_time'. More...
 
static std::string offsetString (Offset offset)
 Converts the given utc/localtime offset into a five-character "+/-hhmm" string. More...
 

Detailed Description

A low-level static class used by Date and Time.

Definition at line 38 of file gdatetime.h.

Member Typedef Documentation

typedef struct std::tm G::DateTime::BrokenDownTime

Definition at line 43 of file gdatetime.h.

typedef std::time_t G::DateTime::EpochTime

Definition at line 41 of file gdatetime.h.

typedef std::pair<bool,unsigned int> G::DateTime::Offset

Definition at line 44 of file gdatetime.h.

Member Function Documentation

G::DateTime::EpochTime G::DateTime::epochTime ( const BrokenDownTime broken_down_time)
static

Converts from UTC broken-down-time to epoch time.

Definition at line 39 of file gdatetime.cpp.

Referenced by G::Date::weekday().

G::DateTime::BrokenDownTime G::DateTime::local ( EpochTime  epoch_time)
static

Converts from epoch time to local broken-down-time.

Definition at line 63 of file gdatetime.cpp.

Referenced by G::Date::Date(), GSmtp::ServerProtocolText::receivedLine(), and G::Time::Time().

G::DateTime::EpochTime G::DateTime::now ( )
static
G::DateTime::Offset G::DateTime::offset ( EpochTime  epoch_time)
static

Returns the offset between UTC and localtime as at 'epoch_time'.

The returned pair has 'first' set to true if localtime is ahead of (ie. east of) UTC.

(Note that this may be a relatively expensive operation.)

Definition at line 71 of file gdatetime.cpp.

Referenced by GSmtp::ServerProtocolText::receivedLine().

std::string G::DateTime::offsetString ( Offset  offset)
static

Converts the given utc/localtime offset into a five-character "+/-hhmm" string.

See also RFC2822.

Definition at line 81 of file gdatetime.cpp.

Referenced by GSmtp::ServerProtocolText::receivedLine().

G::DateTime::BrokenDownTime G::DateTime::utc ( EpochTime  epoch_time)
static

Converts from epoch time to UTC broken-down-time.

Definition at line 55 of file gdatetime.cpp.

Referenced by G::Date::Date(), G::Time::Time(), and G::Date::weekday().


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