time/ISO8601: don't use glibc extension in strptime.

Per the manual for strptime, %F is equivalent %Y-%m-%d, so use that
directly.
This commit is contained in:
Érico Rolim 2021-02-25 13:53:31 -03:00 committed by Max Kellermann
parent c95e3dc065
commit 8d80280ab9
2 changed files with 3 additions and 1 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.22.7 (not yet released) ver 0.22.7 (not yet released)
* protocol
- don't use glibc extension to parse time stamps
* decoder * decoder
- ffmpeg: fix build problem with FFmpeg 3.4 - ffmpeg: fix build problem with FFmpeg 3.4
* storage * storage

View File

@ -185,7 +185,7 @@ ParseISO8601(const char *s)
struct tm tm{}; struct tm tm{};
/* parse the date */ /* parse the date */
const char *end = strptime(s, "%F", &tm); const char *end = strptime(s, "%Y-%m-%d", &tm);
if (end == nullptr) { if (end == nullptr) {
/* try without field separators */ /* try without field separators */
end = strptime(s, "%Y%m%d", &tm); end = strptime(s, "%Y%m%d", &tm);