diff --git a/src/logging.cpp b/src/logging.cpp --- a/src/logging.cpp +++ b/src/logging.cpp @@ -192,10 +192,10 @@ strStamped.pop_back(); strStamped += strprintf(".%06dZ", nTimeMicros % 1000000); } - int64_t mocktime = GetMockTime(); - if (mocktime) { - strStamped += - " (mocktime: " + FormatISO8601DateTime(mocktime) + ")"; + std::chrono::seconds mocktime = GetMockTime(); + if (mocktime > 0s) { + strStamped += " (mocktime: " + + FormatISO8601DateTime(count_seconds(mocktime)) + ")"; } strStamped += ' ' + str; } else { diff --git a/src/util/time.h b/src/util/time.h --- a/src/util/time.h +++ b/src/util/time.h @@ -62,8 +62,9 @@ /** For testing. Set e.g. with the setmocktime rpc, or -mocktime argument */ void SetMockTime(int64_t nMockTimeIn); + /** For testing */ -int64_t GetMockTime(); +std::chrono::seconds GetMockTime(); /** Return system time (or mocked time, if set) */ template T GetTime(); diff --git a/src/util/time.cpp b/src/util/time.cpp --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -96,8 +96,8 @@ nMockTime.store(nMockTimeIn, std::memory_order_relaxed); } -int64_t GetMockTime() { - return nMockTime.load(std::memory_order_relaxed); +std::chrono::seconds GetMockTime() { + return std::chrono::seconds(nMockTime.load(std::memory_order_relaxed)); } int64_t GetTimeMillis() {