From dffb1abdf17dae2815199fa1361cc1288516e0f4 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 12 Aug 2015 08:04:29 -0400 Subject: [PATCH] Variant: Duration replaced by ISO8601p --- src/Variant.cpp | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/src/Variant.cpp b/src/Variant.cpp index f795e54b7..e8f7d013c 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -1955,15 +1954,6 @@ void Variant::cast (const enum type new_type) break; } - pos = 0; - Duration dur; - if (dur.parse (_string, pos) && - pos == _string.length ()) - { - _date = Date ().toEpoch () + (time_t) dur; - break; - } - if (dateFormat != "") { _date = Date (_string, dateFormat).toEpoch (); @@ -1974,22 +1964,12 @@ void Variant::cast (const enum type new_type) case type_duration: { _duration = 0; - Duration dur; std::string::size_type pos = 0; - if (dur.parse (_string, pos) && + ISO8601p iso; + if (iso.parse (_string, pos) && pos == _string.length ()) { - _duration = (time_t) dur; - } - else - { - ISO8601p iso; - pos = 0; - if (iso.parse (_string, pos) && - pos == _string.length ()) - { - _duration = (time_t) iso; - } + _duration = (time_t) iso; } } break;