mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ISO8601d: Added ::toEpoch
This commit is contained in:
parent
2414f6b3d4
commit
85703803c8
2 changed files with 14 additions and 0 deletions
|
@ -631,6 +631,19 @@ void ISO8601d::resolve ()
|
||||||
_date = utc ? timegm (&t) : mktime (&t);
|
_date = utc ? timegm (&t) : mktime (&t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool ISO8601d::isEpoch (const std::string& input)
|
||||||
|
{
|
||||||
|
if (Lexer::isAllDigits (input) &&
|
||||||
|
input.length () <= 10 )
|
||||||
|
{
|
||||||
|
_date = (time_t) strtol (input.c_str (), NULL, 10);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
ISO8601p::ISO8601p ()
|
ISO8601p::ISO8601p ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,6 +111,7 @@ private:
|
||||||
int dayOfWeek (int, int, int);
|
int dayOfWeek (int, int, int);
|
||||||
bool validate ();
|
bool validate ();
|
||||||
void resolve ();
|
void resolve ();
|
||||||
|
bool isEpoch (const std::string&);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int _year;
|
int _year;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue