From 1fdadf06f15df17d78375b9ef8b195522e8d8b24 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 27 Mar 2020 00:38:11 -0700 Subject: [PATCH] testy: don't give Clock.Step==0 magical behavior. Turns out it's sometimes useful to stop time entirely. Signed-off-by: David Anderson --- testy/clock.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/testy/clock.go b/testy/clock.go index 006c0eaf1..5b364411b 100644 --- a/testy/clock.go +++ b/testy/clock.go @@ -10,13 +10,11 @@ import "time" // called, beginning at Start. // // The zero value starts virtual time at an arbitrary value recorded -// in Start on the first call to Now, and increments by one second -// between calls to Now. +// in Start on the first call to Now, and time never advances. type Clock struct { // Start is the first value returned by Now. Start time.Time // Step is how much to advance with each Now call. - // Zero means 1 second. Step time.Duration // Present is the time that the next Now call will receive. Present time.Time @@ -30,9 +28,6 @@ func (c *Clock) Now() time.Time { c.Present = c.Start } step := c.Step - if step == 0 { - step = time.Second - } ret := c.Present c.Present = c.Present.Add(step) return ret