time/ISO8601: allow omitting the "Z" suffix

And allow "Z" suffix after date.
This commit is contained in:
Max Kellermann
2019-08-19 22:35:47 +02:00
parent ba4cd47fd8
commit b06825829b
3 changed files with 12 additions and 2 deletions

View File

@@ -83,7 +83,7 @@ ParseISO8601(const char *s)
/* parse the time of day */
if (*s == 'T') {
++s;
end = strptime(s, "%TZ", &tm);
end = strptime(s, "%T", &tm);
if (end == nullptr)
throw std::runtime_error("Failed to parse time of day");
@@ -93,6 +93,9 @@ ParseISO8601(const char *s)
auto tp = TimeGm(tm);
if (*s == 'Z')
++s;
if (*s != 0)
throw std::runtime_error("Garbage at end of time stamp");