var _ … var _ … var _ … type FakePassiveClock … type FakeClock … type fakeClockWaiter … // NewFakePassiveClock returns a new FakePassiveClock. func NewFakePassiveClock(t time.Time) *FakePassiveClock { … } // NewFakeClock constructs a fake clock set to the provided time. func NewFakeClock(t time.Time) *FakeClock { … } // Now returns f's time. func (f *FakePassiveClock) Now() time.Time { … } // Since returns time since the time in f. func (f *FakePassiveClock) Since(ts time.Time) time.Duration { … } // SetTime sets the time on the FakePassiveClock. func (f *FakePassiveClock) SetTime(t time.Time) { … } // After is the fake version of time.After(d). func (f *FakeClock) After(d time.Duration) <-chan time.Time { … } // NewTimer constructs a fake timer, akin to time.NewTimer(d). func (f *FakeClock) NewTimer(d time.Duration) clock.Timer { … } // AfterFunc is the Fake version of time.AfterFunc(d, cb). func (f *FakeClock) AfterFunc(d time.Duration, cb func()) clock.Timer { … } // Tick constructs a fake ticker, akin to time.Tick func (f *FakeClock) Tick(d time.Duration) <-chan time.Time { … } // NewTicker returns a new Ticker. func (f *FakeClock) NewTicker(d time.Duration) clock.Ticker { … } // Step moves the clock by Duration and notifies anyone that's called After, // Tick, or NewTimer. func (f *FakeClock) Step(d time.Duration) { … } // SetTime sets the time. func (f *FakeClock) SetTime(t time.Time) { … } // Actually changes the time and checks any waiters. f must be write-locked. func (f *FakeClock) setTimeLocked(t time.Time) { … } // HasWaiters returns true if After or AfterFunc has been called on f but not yet satisfied (so you can // write race-free tests). func (f *FakeClock) HasWaiters() bool { … } // Sleep is akin to time.Sleep func (f *FakeClock) Sleep(d time.Duration) { … } type IntervalClock … // Now returns i's time. func (i *IntervalClock) Now() time.Time { … } // Since returns time since the time in i. func (i *IntervalClock) Since(ts time.Time) time.Duration { … } // After is unimplemented, will panic. // TODO: make interval clock use FakeClock so this can be implemented. func (*IntervalClock) After(d time.Duration) <-chan time.Time { … } // NewTimer is unimplemented, will panic. // TODO: make interval clock use FakeClock so this can be implemented. func (*IntervalClock) NewTimer(d time.Duration) clock.Timer { … } // AfterFunc is unimplemented, will panic. // TODO: make interval clock use FakeClock so this can be implemented. func (*IntervalClock) AfterFunc(d time.Duration, f func()) clock.Timer { … } // Tick is unimplemented, will panic. // TODO: make interval clock use FakeClock so this can be implemented. func (*IntervalClock) Tick(d time.Duration) <-chan time.Time { … } // NewTicker has no implementation yet and is omitted. // TODO: make interval clock use FakeClock so this can be implemented. func (*IntervalClock) NewTicker(d time.Duration) clock.Ticker { … } // Sleep is unimplemented, will panic. func (*IntervalClock) Sleep(d time.Duration) { … } var _ … type fakeTimer … // C returns the channel that notifies when this timer has fired. func (f *fakeTimer) C() <-chan time.Time { … } // Stop stops the timer and returns true if the timer has not yet fired, or false otherwise. func (f *fakeTimer) Stop() bool { … } // Reset resets the timer to the fake clock's "now" + d. It returns true if the timer has not yet // fired, or false otherwise. func (f *fakeTimer) Reset(d time.Duration) bool { … } type fakeTicker … func (t *fakeTicker) C() <-chan time.Time { … } func (t *fakeTicker) Stop() { … }