diff --git a/ChangeLog b/ChangeLog index 16e2d2fec..81481dc19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -185,6 +185,7 @@ (thanks to Owen Clarke). + Fixed bug #808, which generated compiler warnings on Solarix (thanks to Owen Clarke). + + Fixed bug #831, which prevented some date fields from being properly parsed. # Untracked Bugs, biggest first. + Fixed bug that required the '%YAML' prologue in a YAML import. diff --git a/src/Date.cpp b/src/Date.cpp index 89fb6e178..4644a1823 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -128,10 +128,6 @@ Date::Date (const int m, const int d, const int y, //////////////////////////////////////////////////////////////////////////////// Date::Date (const std::string& input, const std::string& format /* = "m/d/Y" */) { - // Perhaps it is an epoch date, in string form? - if (isEpoch (input)) - return; - // Before parsing according to "format", perhaps this is a relative date? if (isRelativeDate (input)) return; @@ -145,6 +141,10 @@ Date::Date (const std::string& input, const std::string& format /* = "m/d/Y" */) if (n.getDate (format, _t) && n.depleted ()) return; + // Perhaps it is an epoch date, in string form? + if (isEpoch (input)) + return; + throw ::format (STRING_DATE_INVALID_FORMAT, input, format); } @@ -771,8 +771,7 @@ void Date::operator++ (int) //////////////////////////////////////////////////////////////////////////////// bool Date::isEpoch (const std::string& input) { - if (digitsOnly (input) && - input.length () > 8 && + if (digitsOnly (input) && input.length () <= 10 ) { _t = (time_t) atoi (input.c_str ());