Skip to content

Commit

Permalink
Merge pull request #55 from DPJacques/rand
Browse files Browse the repository at this point in the history
Use the current time for NewFakeClock's initial value
  • Loading branch information
sagikazarmark committed Apr 1, 2023
2 parents 684ad58 + 1dd6ef9 commit 606c48b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions clockwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ func NewRealClock() Clock {

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

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

0 comments on commit 606c48b

Please sign in to comment.