diff options
author | Kargatum <dowlandtop@yandex.com> | 2022-01-19 12:01:59 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 12:01:59 +0700 |
commit | 259b9133f68ef0d740fc871d59fab3d2791f33b4 (patch) | |
tree | 89da4d2a14ee203de3baff62e6c2d5b4b025bbfa /src/common/Logging/Log.cpp | |
parent | b5ab409614bf0d45e7a4f03c57b15edf113fe5f0 (diff) |
feat(Core/Common): add new helpers for time utility (#10207)
Diffstat (limited to 'src/common/Logging/Log.cpp')
-rw-r--r-- | src/common/Logging/Log.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index 05a5d63671..7b4980cfe0 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -24,8 +24,8 @@ #include "LogOperation.h" #include "Logger.h" #include "StringConvert.h" +#include "Timer.h" #include "Tokenize.h" -#include "Util.h" #include <chrono> #include <sstream> @@ -275,19 +275,7 @@ Logger const* Log::GetLoggerByType(std::string const& type) const std::string Log::GetTimestampStr() { - time_t tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - - std::tm aTm; - localtime_r(&tt, &aTm); - - // YYYY year - // MM month (2 digits 01-12) - // DD day (2 digits 01-31) - // HH hour (2 digits 00-23) - // MM minutes (2 digits 00-59) - // SS seconds (2 digits 00-59) - 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(GetEpochTime(), "%Y-%m-%d_%H_%M_%S"); } bool Log::SetLogLevel(std::string const& name, int32 newLeveli, bool isLogger /* = true */) |