diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 604fc06fe4..404b978a7f 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -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(¤tTime), "%Y.%m.%d %T UTC") << std::endl; + tm timeinfo{}; +#ifdef _WIN32 + gmtime_s(&timeinfo, ¤tTime); +#else + gmtime_r(¤tTime, &timeinfo); +#endif + msg << std::put_time(&timeinfo, "%Y.%m.%d %T UTC") << std::endl; msg << "Content file: " << ptr.getCellRef().getRefNum().mContentFile;