Skip to content

Commit 606c48b

Browse files
Merge pull request #55 from DPJacques/rand
Use the current time for NewFakeClock's initial value
2 parents 684ad58 + 1dd6ef9 commit 606c48b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clockwork.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ func NewRealClock() Clock {
4343

4444
// NewFakeClock returns a FakeClock implementation which can be
4545
// manually advanced through time for testing. The initial time of the
46-
// FakeClock will be an arbitrary non-zero time.
46+
// FakeClock will be the current system time.
47+
//
48+
// Tests that require a deterministic time must use NewFakeClockAt.
4749
func NewFakeClock() FakeClock {
48-
// Use the standard layout time to avoid fulfilling Time.IsZero().
49-
return NewFakeClockAt(time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC))
50+
return NewFakeClockAt(time.Now())
5051
}
5152

5253
// NewFakeClockAt returns a FakeClock initialised at the given time.Time.

0 commit comments

Comments
 (0)