summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-08-19 22:37:16 +0200
committerMax Kellermann <max@musicpd.org>2019-12-16 23:24:43 +0100
commitd09bd9178f30e9e8bb1034efec7d713f53e924df (patch)
treecbe3d7ca16d65d5d152e0605b7f4924d8129f02b /src
parent7d8b1860c315ca403560385d6b426877f2e8e46b (diff)
time/ISO8601: support omitting seconds
Diffstat (limited to 'src')
-rw-r--r--src/time/ISO8601.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/time/ISO8601.cxx b/src/time/ISO8601.cxx
index 6671a8ca4..f4d0d5d38 100644
--- a/src/time/ISO8601.cxx
+++ b/src/time/ISO8601.cxx
@@ -133,12 +133,15 @@ ParseISO8601(const char *s)
/* parse the time of day */
if (*s == 'T') {
++s;
- end = strptime(s, "%T", &tm);
- if (end == nullptr)
+
+ if ((end = strptime(s, "%T", &tm)) != nullptr)
+ precision = std::chrono::seconds(1);
+ else if ((end = strptime(s, "%H:%M", &tm)) != nullptr)
+ precision = std::chrono::minutes(1);
+ else
throw std::runtime_error("Failed to parse time of day");
s = end;
- precision = std::chrono::seconds(1);
}
auto tp = TimeGm(tm);