From 10b63f27cec5312fd1ec465940ec8a0034c18932 Mon Sep 17 00:00:00 2001 From: Alex Chan Date: Mon, 27 Apr 2026 22:29:49 +0100 Subject: [PATCH] tstest/clock: explain what happens if you don't set a Start time While working on #19444, I assumed that omitting `Start` would return a clock that started at January 1, year 1, because that's the zero value for a `time.Time`, but actually it uses the current UTC time instead. This behaviour is non-obvious, so document it. Updates #cleanup Change-Id: Id91400778578655953ff3e1671ce470db97cfe91 Signed-off-by: Alex Chan --- tstest/clock.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tstest/clock.go b/tstest/clock.go index 5742c6e5a..1f88fb0a2 100644 --- a/tstest/clock.go +++ b/tstest/clock.go @@ -20,6 +20,9 @@ type ClockOpts struct { // to Clock.Now. If you are passing a value here, set an explicit // timezone, otherwise the test may be non-deterministic when TZ environment // variable is set to different values. The default time is in UTC. + // + // If you do not pass an explicit Start time, the clock will start at the + // current UTC time. Start time.Time // Step is the amount of time the Clock will advance whenever Clock.Now is