From b02890eb8a1b014e575efe4130793d31a5ac0bb1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 19 Aug 2019 22:09:38 +0200 Subject: time/Parser: explicitly initialize struct tm before strptime() This is recommended by the strptime() manpage, because strptime() does not initialize/set attributes which were not specified in the format string. --- src/time/Parser.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time/Parser.cxx b/src/time/Parser.cxx index b09bba14f..369408efb 100644 --- a/src/time/Parser.cxx +++ b/src/time/Parser.cxx @@ -65,7 +65,7 @@ ParseTimePoint(const char *s, const char *format) (void)format; throw std::runtime_error("Time parsing not implemented on Windows"); #else - struct tm tm; + struct tm tm{}; const char *end = strptime(s, format, &tm); if (end == nullptr || *end != 0) throw std::runtime_error("Failed to parse time stamp"); -- cgit v1.2.3