refactor: Replace GetTimeMicros by SystemClock

This commit is contained in:
MarcoFalke
2023-03-09 14:53:36 +01:00
parent 8d12127a9c
commit faf3f12424
3 changed files with 9 additions and 13 deletions

View File

@@ -349,11 +349,12 @@ std::string BCLog::Logger::LogTimestampStr(const std::string& str)
return str;
if (m_started_new_line) {
int64_t nTimeMicros = GetTimeMicros();
strStamped = FormatISO8601DateTime(nTimeMicros/1000000);
const auto now{SystemClock::now()};
const auto now_seconds{std::chrono::time_point_cast<std::chrono::seconds>(now)};
strStamped = FormatISO8601DateTime(TicksSinceEpoch<std::chrono::seconds>(now_seconds));
if (m_log_time_micros) {
strStamped.pop_back();
strStamped += strprintf(".%06dZ", nTimeMicros%1000000);
strStamped += strprintf(".%06dZ", Ticks<std::chrono::microseconds>(now - now_seconds));
}
std::chrono::seconds mocktime = GetMockTime();
if (mocktime > 0s) {