From d9a3be999349e7044c33cd4b08181d6ed2477863 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 11 Dec 2016 21:03:15 -0500 Subject: [PATCH] Variant: Converted from ISO8601p to Duration --- src/Variant.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Variant.cpp b/src/Variant.cpp index a4a287515..0bcdbe898 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include @@ -1730,10 +1732,10 @@ Variant::operator std::string () const return _string; case type_date: - return ISO8601d (_date).toISOLocalExtended (); + return Datetime (_date).toISOLocalExtended (); case type_duration: - return ISO8601p (_duration).format (); + return Duration (_duration).formatISO (); } return ""; @@ -1836,11 +1838,11 @@ void Variant::cast (const enum type new_type) } pos = 0; - ISO8601p isop; + Duration isop; if (isop.parse (_string, pos) && pos == _string.length ()) { - _date = ISO8601d ().toEpoch () + (time_t) isop; + _date = ISO8601d ().toEpoch () + isop.toTime_t (); break; } @@ -1855,11 +1857,11 @@ void Variant::cast (const enum type new_type) { _duration = 0; std::string::size_type pos = 0; - ISO8601p iso; + Duration iso; if (iso.parse (_string, pos) && pos == _string.length ()) { - _duration = (time_t) iso; + _duration = iso.toTime_t (); } } break;