mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
ISO8601d: Epoch strings are parsed without the same validation as other dates
This commit is contained in:
parent
5cc3c8d05d
commit
b0e249e564
1 changed files with 13 additions and 7 deletions
|
@ -234,14 +234,13 @@ bool ISO8601d::parse (
|
|||
auto i = start;
|
||||
Nibbler n (input.substr (i));
|
||||
if (parse_formatted (n, format) ||
|
||||
parse_date_time (n) || // Strictest first.
|
||||
parse_date_time (n) || // Strictest first.
|
||||
parse_date_time_ext (n) ||
|
||||
parse_date_ext (n) ||
|
||||
parse_time_utc_ext (n) ||
|
||||
parse_time_off_ext (n) ||
|
||||
parse_time_ext (n) ||
|
||||
parse_named (n) ||
|
||||
parse_epoch (n)) // Time last, as it is the most permissive.
|
||||
parse_time_ext (n) || // Time last, as it is the most permissive.
|
||||
parse_named (n))
|
||||
{
|
||||
// Check the values and determine time_t.
|
||||
if (validate ())
|
||||
|
@ -254,6 +253,13 @@ bool ISO8601d::parse (
|
|||
}
|
||||
}
|
||||
|
||||
// ::parse_epoch doesn't require ::validate and ::resolve.
|
||||
else if (parse_epoch (n))
|
||||
{
|
||||
start = n.cursor ();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -953,9 +959,9 @@ void ISO8601d::resolve ()
|
|||
seconds %= 86400;
|
||||
}
|
||||
|
||||
t.tm_hour = seconds / 3600;
|
||||
t.tm_min = (seconds % 3600) / 60;
|
||||
t.tm_sec = seconds % 60;
|
||||
t.tm_hour = seconds / 3600;
|
||||
t.tm_min = (seconds % 3600) / 60;
|
||||
t.tm_sec = seconds % 60;
|
||||
|
||||
_date = utc ? timegm (&t) : mktime (&t);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue