#include <Date.h>
Public Types | |
typedef time_t | ValueType |
Public Member Functions | |
Date () | |
Default ctor: 0. | |
Date (ValueType date_r) | |
Ctor taking time_t value. | |
Date (const std::string &seconds_r) | |
Ctor taking time_t value as string. | |
Date (const std::string &date_str, const std::string &format) | |
Ctor from a date_str formatted using format. | |
operator ValueType () const | |
Conversion to time_t. | |
std::string | form (const std::string &format_r) const |
Return string representation according to format. | |
std::string | asString () const |
Default string representation of Date. | |
std::string | asSeconds () const |
Convert to string representation of calendar time in numeric form (like "1029255142"). | |
Arithmetic operations. | |
+ - * / are provided via conversion to time_t. | |
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 () |
Return the current time. | |
Static Public Attributes | |
static const ValueType | second = 1 |
static const ValueType | minute = 60 |
static const ValueType | hour = 3600 |
static const ValueType | day = 86400 |
static const ValueType | month28 = 2419200 |
static const ValueType | month29 = 2505600 |
static const ValueType | month30 = 2592000 |
static const ValueType | month31 = 2678400 |
static const ValueType | month = month30 |
static const ValueType | year365 = 31536000 |
static const ValueType | year366 = 31622400 |
static const ValueType | year = year365 |
Private Attributes | |
ValueType | _date |
Calendar time. | |
Friends | |
std::ostream & | operator<< (std::ostream &str, const Date &obj) |
Definition at line 31 of file Date.h.
typedef time_t zypp::Date::ValueType |
zypp::Date::Date | ( | ValueType | date_r | ) | [inline] |
zypp::Date::Date | ( | const std::string & | seconds_r | ) |
Ctor taking time_t value as string.
Definition at line 33 of file Date.cc.
References _date, and zypp::str::strtonum().
zypp::Date::Date | ( | const std::string & | date_str, | |
const std::string & | format | |||
) |
Ctor from a date_str formatted using format.
DateFormatException | in case date_str cannot be parsed according to format. |
Definition at line 36 of file Date.cc.
References _date, zypp::adjustLocale(), zypp::str::form(), and zypp::restoreLocale().
static Date zypp::Date::now | ( | ) | [inline, static] |
Return the current time.
Definition at line 72 of file Date.h.
Referenced by zypp::RepoManager::checkIfToRefreshMetadata(), zypp::PublicKey::Impl::daysToLive(), zypp::PublicKey::Impl::expired(), zypp::base::LogControl::LineFormater::format(), zypp::RepoManager::makeStupidAlias(), zypp::Repository::maybeOutdated(), zypp::ProgressData::report(), zypp::target::SoftLocksFile::store(), zypp::target::RequestedLocalesFile::store(), zypp::target::rpm::RpmDb::timestamp(), zypp::target::writeUpgradeTestcase(), and zypp::syscontent::Writer::Impl::writeXml().
zypp::Date::operator ValueType | ( | ) | const [inline] |
Date& zypp::Date::operator+= | ( | const time_t | rhs | ) | [inline] |
Date& zypp::Date::operator-= | ( | const time_t | rhs | ) | [inline] |
Date& zypp::Date::operator*= | ( | const time_t | rhs | ) | [inline] |
Date& zypp::Date::operator/= | ( | const time_t | rhs | ) | [inline] |
Date zypp::Date::operator++ | ( | int | ) | [inline] |
Date zypp::Date::operator-- | ( | int | ) | [inline] |
std::string zypp::Date::form | ( | const std::string & | format_r | ) | const |
Return string representation according to format.
Definition at line 58 of file Date.cc.
References _date, zypp::adjustLocale(), and zypp::restoreLocale().
Referenced by asSeconds(), and asString().
std::string zypp::Date::asString | ( | ) | const [inline] |
Default string representation of Date.
The preferred date and time representation for the current locale.
Definition at line 108 of file Date.h.
References form().
Referenced by zypp::PublicKey::Impl::expiresAsString().
std::string zypp::Date::asSeconds | ( | ) | const [inline] |
Convert to string representation of calendar time in numeric form (like "1029255142").
Definition at line 114 of file Date.h.
References form().
Referenced by zypp::syscontent::Writer::Impl::writeXml().
std::ostream & operator<< | ( | std::ostream & | str, | |
const Date & | obj | |||
) | [friend] |
const ValueType zypp::Date::second = 1 [static] |
const ValueType zypp::Date::minute = 60 [static] |
const ValueType zypp::Date::hour = 3600 [static] |
const ValueType zypp::Date::day = 86400 [static] |
const ValueType zypp::Date::month28 = 2419200 [static] |
const ValueType zypp::Date::month29 = 2505600 [static] |
const ValueType zypp::Date::month30 = 2592000 [static] |
const ValueType zypp::Date::month31 = 2678400 [static] |
const ValueType zypp::Date::month = month30 [static] |
const ValueType zypp::Date::year365 = 31536000 [static] |
const ValueType zypp::Date::year366 = 31622400 [static] |
const ValueType zypp::Date::year = year365 [static] |
ValueType zypp::Date::_date [private] |
Calendar time.
The number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
Definition at line 122 of file Date.h.
Referenced by Date(), form(), operator ValueType(), operator*=(), operator++(), operator+=(), operator--(), operator-=(), and operator/=().