From 758fea59a895453a9bf80ea25fe86b6df3188bce Mon Sep 17 00:00:00 2001 From: seduless Date: Fri, 17 Apr 2026 22:51:27 +0000 Subject: [PATCH] test: Drop ++ from NodeClockContext default constructor The increment was originally added so that mocked time would not appear to go backward relative to real-clock timestamps captured before construction, since Now() rounds the current time down to a whole second. In practice the tests do not mix real and mocked timestamps in a way that exposes this, so the increment is unnecessary. --- src/test/util/time.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/util/time.h b/src/test/util/time.h index 8cd9a1dafcb..72dfd0e7a88 100644 --- a/src/test/util/time.h +++ b/src/test/util/time.h @@ -44,8 +44,8 @@ public: /// Initialize with the given time. explicit NodeClockContext(NodeSeconds init_time) { set(init_time); } explicit NodeClockContext(std::chrono::seconds init_time) { set(init_time); } - /// Initialize with current time, using the next tick to avoid going back by rounding to seconds. - explicit NodeClockContext() { set(++Now().time_since_epoch()); } + /// Initialize with current time. + explicit NodeClockContext() { set(Now()); } /// Unset mocktime. ~NodeClockContext() { set(0s); }