libcamgm
|
#include <Date.hpp>
Public Types | |
typedef time_t | ValueType |
Public Member Functions | |
Date () | |
Date (ValueType date_r) | |
Date (const std::string &seconds_r) | |
Date (const std::string &date_str, const std::string &format, bool utc=false) | |
operator ValueType () const | |
std::string | form (const std::string &format_r, bool utc=false) const |
std::string | asString () const |
std::string | asSeconds () const |
Arithmetic operations. | |
| |
Date & | operator+= (const time_t rhs) |
Date & | operator-= (const time_t rhs) |
Date & | operator*= (const time_t rhs) |
Date & | operator/= (const time_t rhs) |
Date & | operator++ () |
Date & | operator-- () |
Date | operator++ (int) |
Date | operator-- (int) |
Static Public Member Functions | |
static Date | now () |
Private Attributes | |
ValueType | _date |
Friends | |
std::ostream & | operator<< (std::ostream &str, const Date &obj) |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &str, const Date &obj) |
Store and operate on date (time_t).
typedef time_t ca_mgm::Date::ValueType |
|
inline |
Default ctor: 0
|
inline |
Ctor taking time_t value.
ca_mgm::Date::Date | ( | const std::string & | seconds_r | ) |
Ctor taking time_t value as string.
ca_mgm::Date::Date | ( | const std::string & | date_str, |
const std::string & | format, | ||
bool | utc = false |
||
) |
Ctor from a date_str formatted using format.
DateFormatException | in case date_str cannot be parsed according to format. |
|
inline |
Convert to string representation of calendar time in numeric form (like "1029255142").
References form().
|
inline |
Default string representation of Date. The preferred date and time representation for the current locale.
References form().
Referenced by operator<<().
std::string ca_mgm::Date::form | ( | const std::string & | format_r, |
bool | utc = false |
||
) | const |
Return string representation according to format.
Referenced by asSeconds(), and asString().
|
inlinestatic |
Return the current time.
|
friend |
|
related |
Stream output
References asString().
|
private |
Calendar time. The number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
Referenced by operator ValueType(), operator*=(), operator++(), operator+=(), operator--(), operator-=(), and operator/=().