Commit b02890eb authored by Max Kellermann's avatar Max Kellermann

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.
parent da882a6e
...@@ -65,7 +65,7 @@ ParseTimePoint(const char *s, const char *format) ...@@ -65,7 +65,7 @@ ParseTimePoint(const char *s, const char *format)
(void)format; (void)format;
throw std::runtime_error("Time parsing not implemented on Windows"); throw std::runtime_error("Time parsing not implemented on Windows");
#else #else
struct tm tm; struct tm tm{};
const char *end = strptime(s, format, &tm); const char *end = strptime(s, format, &tm);
if (end == nullptr || *end != 0) if (end == nullptr || *end != 0)
throw std::runtime_error("Failed to parse time stamp"); throw std::runtime_error("Failed to parse time stamp");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment