34 friend std::ostream &
operator<<( std::ostream & str,
const Date & obj );
64 explicit Date(
const std::string & seconds_r );
72 Date(
const std::string & date_str,
const std::string & format );
74 Date(
const std::string & date_str,
const std::string & format,
TimeBase base_r );
78 { return ::time( 0 ); }
111 std::string
form(
const std::string & format_r )
const
114 std::string
form(
const std::string & format_r,
TimeBase base_r )
const;
120 {
return form(
"%c" ); }
126 {
return form(
"%s" ); }
168 {
return print( DateFormat::calendar, timeFormat_r, timeZoneFormat_r, base_r ); }
171 {
return print( dateFormat_r, TimeFormat::seconds, timeZoneFormat_r, base_r ); }
174 {
return print( dateFormat_r, timeFormat_r, TimeZoneFormat::name, base_r ); }
177 {
return print( DateFormat::calendar, TimeFormat::seconds, timeZoneFormat_r, base_r ); }
180 {
return print( DateFormat::calendar, timeFormat_r, TimeZoneFormat::name, base_r ); }
183 {
return print( dateFormat_r, TimeFormat::seconds, TimeZoneFormat::name, base_r ); }
186 {
return print( DateFormat::calendar, TimeFormat::seconds, TimeZoneFormat::name, base_r ); }
192 {
return print( dateFormat_r, TimeFormat::none, TimeZoneFormat::none, base_r ); }
195 {
return printDate( DateFormat::calendar, base_r ); }
201 {
return print( DateFormat::none, timeFormat_r, timeZoneFormat_r, base_r ); }
204 {
return printTime( TimeFormat::seconds, timeZoneFormat_r, base_r ); }
207 {
return printTime( timeFormat_r, TimeZoneFormat::name, base_r ); }
210 {
return printTime( TimeFormat::seconds, TimeZoneFormat::name, base_r ); }
220 {
return printISO( DateFormat::calendar, timeFormat_r, timeZoneFormat_r, base_r ); }
223 {
return printISO( dateFormat_r, TimeFormat::seconds, timeZoneFormat_r, base_r ); }
226 {
return printISO( dateFormat_r, timeFormat_r, TimeZoneFormat::name, base_r ); }
229 {
return printISO( DateFormat::calendar, TimeFormat::seconds, timeZoneFormat_r, base_r ); }
232 {
return printISO( DateFormat::calendar, timeFormat_r, TimeZoneFormat::name, base_r ); }
235 {
return printISO( dateFormat_r, TimeFormat::seconds, TimeZoneFormat::name, base_r ); }
238 {
return printISO( DateFormat::calendar, TimeFormat::seconds, TimeZoneFormat::name, base_r ); }
257 std::ostream &
dumpAsXmlOn( std::ostream & str,
const Date & obj,
const std::string & name_r =
"date" );
270 #endif // ZYPP_DATE_H
std::string printISO(TimeFormat timeFormat_r, TimeBase base_r) const
static const ValueType day
Date & operator+=(const time_t rhs)
friend std::ostream & operator<<(std::ostream &str, const Date &obj)
std::string printISO(TimeZoneFormat timeZoneFormat_r, TimeBase base_r=TB_LOCALTIME) const
Date operator+(const time_t rhs) const
static const ValueType minute
static const ValueType month31
std::string printISO(DateFormat dateFormat_r=DateFormat::calendar, TimeFormat timeFormat_r=TimeFormat::seconds, TimeZoneFormat timeZoneFormat_r=TimeZoneFormat::name, TimeBase base_r=TB_LOCALTIME) const
Default ISO 8601 format is '2014-02-07T07:06:41+01'
const std::string & msg() const
Return the message string provided to the ctor.
std::string printDate(DateFormat dateFormat_r=DateFormat::calendar, TimeBase base_r=TB_LOCALTIME) const
Convenience for printing the date only ['2014-02-07'] The default is DateFormat::calendar and TB_LOCA...
std::string print(DateFormat dateFormat_r, TimeFormat timeFormat_r, TimeBase base_r) const
std::string printISO(TimeFormat timeFormat_r, TimeZoneFormat timeZoneFormat_r=TimeZoneFormat::name, TimeBase base_r=TB_LOCALTIME) const
std::string printTime(TimeBase base_r) const
base::EnumClass< _DateFormatDef > DateFormat
'enum class DateFormat'
Date(ValueType date_r)
Ctor taking time_t value.
std::string print(TimeZoneFormat timeZoneFormat_r, TimeBase base_r=TB_LOCALTIME) const
static const ValueType month30
Date & operator/=(const time_t rhs)
static const ValueType month
Date operator*(const time_t rhs) const
static const ValueType month29
std::string print(DateFormat dateFormat_r, TimeZoneFormat timeZoneFormat_r, TimeBase base_r=TB_LOCALTIME) const
ValueType _date
Calendar time.
Store and operate on date (time_t).
base::EnumClass< _TimeZoneFormatDef > TimeZoneFormat
'enum class TimeZoneFormat'
std::string print(TimeBase base_r) const
static const ValueType year365
std::ostream & operator<<(std::ostream &str, const Date &obj)
std::string print(DateFormat dateFormat_r, TimeBase base_r) const
static const ValueType month28
static const ValueType year
std::string print(TimeFormat timeFormat_r, TimeZoneFormat timeZoneFormat_r=TimeZoneFormat::name, TimeBase base_r=TB_LOCALTIME) const
std::string printISO(DateFormat dateFormat_r, TimeFormat timeFormat_r, TimeBase base_r) const
Date & operator*=(const time_t rhs)
std::string printTime(TimeFormat timeFormat_r, TimeBase base_r) const
base::EnumClass< _TimeFormatDef > TimeFormat
'enum class TimeFormat'
std::string printTime(TimeFormat timeFormat_r=TimeFormat::seconds, TimeZoneFormat timeZoneFormat_r=TimeZoneFormat::name, TimeBase base_r=TB_LOCALTIME) const
Convenience for printing the time only ['07:06:41 CET'] The default is DateFormat::calendar and TB_LO...
static const ValueType hour
std::string printISO(DateFormat dateFormat_r, TimeBase base_r) const
Base class for Exception.
std::string form(const std::string &format_r) const
Return string representation according to format as localtime.
static Date now()
Return the current time.
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").
Date operator-(const time_t rhs) const
static const ValueType year366
std::string print(DateFormat dateFormat_r=DateFormat::calendar, TimeFormat timeFormat_r=TimeFormat::seconds, TimeZoneFormat timeZoneFormat_r=TimeZoneFormat::name, TimeBase base_r=TB_LOCALTIME) const
Default format is '2014-02-07 07:06:41 CET' The default is DateFormat::calendar, TimeFormat::seconds...
std::string printISO(DateFormat dateFormat_r, TimeZoneFormat timeZoneFormat_r, TimeBase base_r=TB_LOCALTIME) const
Date & operator-=(const time_t rhs)
std::string printTime(TimeZoneFormat timeZoneFormat_r, TimeBase base_r=TB_LOCALTIME) const
std::string printISO(TimeBase base_r) const
std::ostream & dumpAsXmlOn(std::ostream &str, const _Tp &obj, const std::string &name_r)
static const ValueType second
Date operator/(const time_t rhs) const
std::string printDate(TimeBase base_r) const
std::string print(TimeFormat timeFormat_r, TimeBase base_r) const