From 2242cb2a8bf09cbb7daeb794b07d44cab6f939c2 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 26 Sep 2015 15:59:41 -0400 Subject: [PATCH] ISO8601d: Added (m,d,y,h,m,s) ctor --- src/ISO8601.cpp | 19 +++++++++++++++++++ src/ISO8601.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index ef7a62026..d6c0e73e7 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -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 () { diff --git a/src/ISO8601.h b/src/ISO8601.h index a102534f1..559794f4e 100644 --- a/src/ISO8601.h +++ b/src/ISO8601.h @@ -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