diff --git a/OgreMain/src/OgreLog.cpp b/OgreMain/src/OgreLog.cpp index 7131ff4cc86..c9157b00052 100644 --- a/OgreMain/src/OgreLog.cpp +++ b/OgreMain/src/OgreLog.cpp @@ -135,13 +135,9 @@ namespace Ogre { if (mTimeStamp) { - struct tm *pTime; - time_t ctTime; time(&ctTime); - pTime = localtime( &ctTime ); - mLog << std::setw(2) << std::setfill('0') << pTime->tm_hour - << ":" << std::setw(2) << std::setfill('0') << pTime->tm_min - << ":" << std::setw(2) << std::setfill('0') << pTime->tm_sec - << ": "; + auto t = std::time(nullptr); + auto pTime = std::localtime(&t); + mLog << std::put_time(pTime, "%T: "); } mLog << message << std::endl;