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 <alexc@tailscale.com>
This commit is contained in:
Alex Chan 2026-04-27 22:29:49 +01:00 committed by Alex Chan
parent ad5436af0d
commit 10b63f27ce

View File

@ -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