diff --git a/source/adios2/helper/adiosSystem.cpp b/source/adios2/helper/adiosSystem.cpp index 06ef1e423d..fab9d23e08 100644 --- a/source/adios2/helper/adiosSystem.cpp +++ b/source/adios2/helper/adiosSystem.cpp @@ -10,7 +10,9 @@ #include "adiosSystem.h" #include //system_clock, now #include +#include #include //std::cerr +#include #include // std::runtime_error, std::exception #include @@ -48,10 +50,20 @@ bool IsLittleEndian() noexcept std::string LocalTimeDate() noexcept { + struct tm now_tm; + std::ostringstream sout; + std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - return std::string(ctime(&now)); +#ifdef _WIN32 + localtime_s(&now_tm, &now); +#else + localtime_r(&now, &now_tm); +#endif + sout << std::put_time(&now_tm, "%a %b %d %H:%M:%S %Y\n"); + + return sout.str(); } bool IsRowMajor(const std::string hostLanguage) noexcept