MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / LogTimestampStr

Method LogTimestampStr

src/logging.cpp:308–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308std::string BCLog::Logger::LogTimestampStr(SystemClock::time_point now, std::chrono::seconds mocktime) const
309{
310 std::string strStamped;
311
312 if (!m_log_timestamps)
313 return strStamped;
314
315 const auto now_seconds{std::chrono::time_point_cast<std::chrono::seconds>(now)};
316 strStamped = FormatISO8601DateTime(TicksSinceEpoch<std::chrono::seconds>(now_seconds));
317 if (m_log_time_micros && !strStamped.empty()) {
318 strStamped.pop_back();
319 strStamped += strprintf(".%06dZ", Ticks<std::chrono::microseconds>(now - now_seconds));
320 }
321 if (mocktime > 0s) {
322 strStamped += " (mocktime: " + FormatISO8601DateTime(count_seconds(mocktime)) + ")";
323 }
324 strStamped += ' ';
325
326 return strStamped;
327}
328
329namespace BCLog {
330 /** Belts and suspenders: make sure outgoing log messages don't contain

Callers

nothing calls this directly

Calls 4

FormatISO8601DateTimeFunction · 0.85
count_secondsFunction · 0.85
emptyMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected