ISO8601: Made some methods const

This commit is contained in:
Paul Beckingham 2015-10-16 08:22:57 -04:00
parent 5110a83efa
commit 4f11740896
2 changed files with 10 additions and 10 deletions

View file

@ -1004,13 +1004,13 @@ void ISO8601d::resolve ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
time_t ISO8601d::toEpoch () time_t ISO8601d::toEpoch () const
{ {
return _date; return _date;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::string ISO8601d::toEpochString () std::string ISO8601d::toEpochString () const
{ {
std::stringstream epoch; std::stringstream epoch;
epoch << _date; epoch << _date;
@ -1019,7 +1019,7 @@ std::string ISO8601d::toEpochString ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// 19980119T070000Z = YYYYMMDDThhmmssZ // 19980119T070000Z = YYYYMMDDThhmmssZ
std::string ISO8601d::toISO () std::string ISO8601d::toISO () const
{ {
struct tm* t = gmtime (&_date); struct tm* t = gmtime (&_date);
@ -1037,13 +1037,13 @@ std::string ISO8601d::toISO ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
double ISO8601d::toJulian () double ISO8601d::toJulian () const
{ {
return (_date / 86400.0) + 2440587.5; return (_date / 86400.0) + 2440587.5;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ISO8601d::toMDY (int& m, int& d, int& y) void ISO8601d::toMDY (int& m, int& d, int& y) const
{ {
struct tm* t = localtime (&_date); struct tm* t = localtime (&_date);

View file

@ -47,11 +47,11 @@ public:
operator time_t () const; operator time_t () const;
bool parse (const std::string&, std::string::size_type&, const std::string& format = ""); bool parse (const std::string&, std::string::size_type&, const std::string& format = "");
time_t toEpoch (); time_t toEpoch () const;
std::string toEpochString (); std::string toEpochString () const;
std::string toISO (); std::string toISO () const;
double toJulian (); double toJulian () const;
void toMDY (int&, int&, int&); void toMDY (int&, int&, int&) const;
const std::string toString (const std::string& format = "m/d/Y") const; const std::string toString (const std::string& format = "m/d/Y") const;
ISO8601d startOfDay () const; ISO8601d startOfDay () const;