time/ISO8601: support omitting minutes

This commit is contained in:
Max Kellermann
2019-09-02 17:13:54 +02:00
committed by Max Kellermann
parent d09bd9178f
commit 63c5d66016
2 changed files with 6 additions and 0 deletions

View File

@@ -138,6 +138,8 @@ ParseISO8601(const char *s)
precision = std::chrono::seconds(1);
else if ((end = strptime(s, "%H:%M", &tm)) != nullptr)
precision = std::chrono::minutes(1);
else if ((end = strptime(s, "%H", &tm)) != nullptr)
precision = std::chrono::hours(1);
else
throw std::runtime_error("Failed to parse time of day");