ISO8601d: Added (m,d,y,h,m,s) ctor

This commit is contained in:
Paul Beckingham 2015-09-26 15:59:41 -04:00
parent 5073921707
commit 2242cb2a8b
2 changed files with 20 additions and 0 deletions

View file

@ -141,6 +141,25 @@ ISO8601d::ISO8601d (const int m, const int d, const int y)
_date = mktime (&t);
}
////////////////////////////////////////////////////////////////////////////////
ISO8601d::ISO8601d (const int m, const int d, const int y,
const int hr, const int mi, const int se)
{
clear ();
// Error if not valid.
struct tm t = {0};
t.tm_isdst = -1; // Requests that mktime determine summer time effect.
t.tm_mday = d;
t.tm_mon = m - 1;
t.tm_year = y - 1900;
t.tm_hour = hr;
t.tm_min = mi;
t.tm_sec = se;
_date = mktime (&t);
}
////////////////////////////////////////////////////////////////////////////////
ISO8601d::~ISO8601d ()
{

View file

@ -40,6 +40,7 @@ public:
ISO8601d ();
ISO8601d (time_t);
ISO8601d (const int, const int, const int);
ISO8601d (const int, const int, const int, const int, const int, const int);
~ISO8601d ();
ISO8601d (const ISO8601d&); // Unimplemented
ISO8601d& operator= (const ISO8601d&); // Unimplemented