mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 07:57:20 +02:00
Variant: Duration replaced by ISO8601p
This commit is contained in:
parent
a4371752c1
commit
dffb1abdf1
1 changed files with 3 additions and 23 deletions
|
@ -34,7 +34,6 @@
|
||||||
#include <ISO8601.h>
|
#include <ISO8601.h>
|
||||||
#include <Lexer.h>
|
#include <Lexer.h>
|
||||||
#include <Date.h>
|
#include <Date.h>
|
||||||
#include <Duration.h>
|
|
||||||
#include <RX.h>
|
#include <RX.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
|
@ -1955,15 +1954,6 @@ void Variant::cast (const enum type new_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = 0;
|
|
||||||
Duration dur;
|
|
||||||
if (dur.parse (_string, pos) &&
|
|
||||||
pos == _string.length ())
|
|
||||||
{
|
|
||||||
_date = Date ().toEpoch () + (time_t) dur;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dateFormat != "")
|
if (dateFormat != "")
|
||||||
{
|
{
|
||||||
_date = Date (_string, dateFormat).toEpoch ();
|
_date = Date (_string, dateFormat).toEpoch ();
|
||||||
|
@ -1974,24 +1964,14 @@ void Variant::cast (const enum type new_type)
|
||||||
case type_duration:
|
case type_duration:
|
||||||
{
|
{
|
||||||
_duration = 0;
|
_duration = 0;
|
||||||
Duration dur;
|
|
||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
if (dur.parse (_string, pos) &&
|
|
||||||
pos == _string.length ())
|
|
||||||
{
|
|
||||||
_duration = (time_t) dur;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ISO8601p iso;
|
ISO8601p iso;
|
||||||
pos = 0;
|
|
||||||
if (iso.parse (_string, pos) &&
|
if (iso.parse (_string, pos) &&
|
||||||
pos == _string.length ())
|
pos == _string.length ())
|
||||||
{
|
{
|
||||||
_duration = (time_t) iso;
|
_duration = (time_t) iso;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue