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.
This commit is contained in:
parent
da882a6eb6
commit
b02890eb8a
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user