mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
feat(Core/Common): add new helpers for time utility (#10207)
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "LogMessage.h"
|
||||
#include "StringFormat.h"
|
||||
#include "Util.h"
|
||||
#include "Timer.h"
|
||||
|
||||
LogMessage::LogMessage(LogLevel _level, std::string const& _type, std::string&& _text)
|
||||
: level(_level), type(_type), text(std::forward<std::string>(_text)), mtime(time(nullptr))
|
||||
@@ -31,9 +31,7 @@ LogMessage::LogMessage(LogLevel _level, std::string const& _type, std::string&&
|
||||
|
||||
std::string LogMessage::getTimeStr(time_t time)
|
||||
{
|
||||
tm aTm;
|
||||
localtime_r(&time, &aTm);
|
||||
return Acore::StringFormat("%04d-%02d-%02d_%02d:%02d:%02d", aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
|
||||
return Acore::Time::TimeToTimestampStr(Seconds(time), "%Y-%m-%d %X");
|
||||
}
|
||||
|
||||
std::string LogMessage::getTimeStr() const
|
||||
|
||||
Reference in New Issue
Block a user