From 2402ec8d6ed2c40626c44c3ef70a45f75ae9e8fa Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 1 Jul 2015 17:59:27 -0400 Subject: [PATCH] ISO8601: Removed the need for ::ambiguity --- src/ISO8601.cpp | 19 ++++--------------- src/ISO8601.h | 2 -- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index e985fd19a..ac7d14bd2 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -45,15 +45,6 @@ ISO8601d::operator time_t () const return _value; } -//////////////////////////////////////////////////////////////////////////////// -// By default, ISO8601d allows ambiguous dates, such as YYYY, YYYYMMDD, HHMMSS. -// These are also valid numbers. Setting ambiguity to false inhibits the -// parsing of these as dates. -void ISO8601d::ambiguity (bool value) -{ - _ambiguity = value; -} - //////////////////////////////////////////////////////////////////////////////// // Supported: // @@ -125,7 +116,6 @@ bool ISO8601d::parse (const std::string& input, std::string::size_type& start) //////////////////////////////////////////////////////////////////////////////// void ISO8601d::clear () { - _ambiguity = true; _year = 0; _month = 0; _week = 0; @@ -279,15 +269,14 @@ bool ISO8601d::parse_time_ext (Nibbler& n) { seconds += ss; _seconds = seconds; - return true; - } - if (_ambiguity) - { - _seconds = seconds; if (!Lexer::isDigit (n.next ())) return true; } + + _seconds = seconds; + if (!Lexer::isDigit (n.next ())) + return true; } n = backup; diff --git a/src/ISO8601.h b/src/ISO8601.h index 1d9d5f0dd..c4118c04e 100644 --- a/src/ISO8601.h +++ b/src/ISO8601.h @@ -38,7 +38,6 @@ public: ISO8601d (const ISO8601d&); // Unimplemented ISO8601d& operator= (const ISO8601d&); // Unimplemented operator time_t () const; - void ambiguity (bool); bool parse (const std::string&, std::string::size_type&); void clear (); void set_default_time (int, int, int); @@ -55,7 +54,6 @@ private: void resolve (); public: - bool _ambiguity; int _year; int _month; int _week;