aboutsummaryrefslogtreecommitdiff
path: root/src/logging.cpp
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-03-09 14:53:36 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-03-09 15:05:11 +0100
commitfaf3f12424fa8558e65fa3f1dd3aa1d0eea8604e (patch)
treed0a29883cfc45ba7a2e56234938083dda597d24a /src/logging.cpp
parent8d12127a9c19cb218d661a88ab9b6871c9d853b9 (diff)
downloadbitcoin-faf3f12424fa8558e65fa3f1dd3aa1d0eea8604e.tar.xz
refactor: Replace GetTimeMicros by SystemClock
Diffstat (limited to 'src/logging.cpp')
-rw-r--r--src/logging.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/logging.cpp b/src/logging.cpp
index 298ec9c013..a9b2a2b33a 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -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) {