diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index 993e566..7341752 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -118,9 +118,15 @@ struct StringMaker static std::string convert(fs::file_time_type const& value) { std::time_t t = to_time_t(value); - std::tm ttm = *std::localtime(&t); - std::ostringstream os; - os << std::put_time(&ttm, "%Y-%m-%d %H:%M:%S"); + std::tm* ptm = std::localtime(&t); + if (ptm) { + std::tm ttm = *ptm; + std::ostringstream os; + os << std::put_time(&ttm, "%Y-%m-%d %H:%M:%S"); + } + else { + os << "(invalid-time)"; + } return os.str(); } };