diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index 1f2765f38..453db43dc 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -631,6 +631,19 @@ void ISO8601d::resolve () _date = utc ? timegm (&t) : mktime (&t); } +//////////////////////////////////////////////////////////////////////////////// +bool ISO8601d::isEpoch (const std::string& input) +{ + if (Lexer::isAllDigits (input) && + input.length () <= 10 ) + { + _date = (time_t) strtol (input.c_str (), NULL, 10); + return true; + } + + return false; +} + //////////////////////////////////////////////////////////////////////////////// ISO8601p::ISO8601p () { diff --git a/src/ISO8601.h b/src/ISO8601.h index cf4824f23..54ce7332d 100644 --- a/src/ISO8601.h +++ b/src/ISO8601.h @@ -111,6 +111,7 @@ private: int dayOfWeek (int, int, int); bool validate (); void resolve (); + bool isEpoch (const std::string&); public: int _year;