1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-24 22:43:47 +00:00

Replace gmtime with safer equivalents

This commit is contained in:
Alexei Kotov 2022-11-08 16:38:40 +03:00
parent fa820434b6
commit 914fba229d

View File

@ -1321,7 +1321,13 @@ namespace MWScript
msg << "Report time: ";
std::time_t currentTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
msg << std::put_time(std::gmtime(&currentTime), "%Y.%m.%d %T UTC") << std::endl;
tm timeinfo{};
#ifdef _WIN32
gmtime_s(&timeinfo, &currentTime);
#else
gmtime_r(&currentTime, &timeinfo);
#endif
msg << std::put_time(&timeinfo, "%Y.%m.%d %T UTC") << std::endl;
msg << "Content file: " << ptr.getCellRef().getRefNum().mContentFile;