mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ISO8601d: Implemented ::parse_epoch
This commit is contained in:
parent
1d598d0e8c
commit
fdc791a676
1 changed files with 12 additions and 4 deletions
|
@ -582,13 +582,21 @@ bool ISO8601d::parse_named (Nibbler& n)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Valid epoch values are unsigned integers after 1980-01-01T00:00:00Z. This
|
||||||
|
// restriction means that '12' will not be identified as an epoch date.
|
||||||
bool ISO8601d::parse_epoch (Nibbler& n)
|
bool ISO8601d::parse_epoch (Nibbler& n)
|
||||||
{
|
{
|
||||||
/*
|
n.save ();
|
||||||
if (isEpoch (input))
|
|
||||||
return true;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
int epoch;
|
||||||
|
if (n.getUnsignedInt (epoch) &&
|
||||||
|
epoch >= 315532800)
|
||||||
|
{
|
||||||
|
_date = static_cast <time_t> (epoch);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
n.restore ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue