Documentation ¶
Index ¶
- type FakeClock
- func (f *FakeClock) After(d time.Duration) <-chan time.Time
- func (f *FakeClock) HasWaiters() bool
- func (f *FakeClock) NewTimer(d time.Duration) clock.Timer
- func (f *FakeClock) Now() time.Time
- func (f *FakeClock) SetTime(t time.Time)
- func (f *FakeClock) Since(ts time.Time) time.Duration
- func (f *FakeClock) Sleep(d time.Duration)
- func (f *FakeClock) Step(d time.Duration)
- func (f *FakeClock) Tick(d time.Duration) <-chan time.Time
- type IntervalClock
- func (*IntervalClock) After(d time.Duration) <-chan time.Time
- func (*IntervalClock) NewTimer(d time.Duration) clock.Timer
- func (i *IntervalClock) Now() time.Time
- func (i *IntervalClock) Since(ts time.Time) time.Duration
- func (*IntervalClock) Sleep(d time.Duration)
- func (*IntervalClock) Tick(d time.Duration) <-chan time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeClock ¶
type FakeClock struct {
// contains filtered or unexported fields
}
FakeClock implements clock.Clock, but returns an arbitrary time.
func NewFakeClock ¶
NewFakeClock constructs a fake clock set to the provided time.
func (*FakeClock) HasWaiters ¶
HasWaiters returns true if After has been called on f but not yet satisfied (so you can write race-free tests).
type IntervalClock ¶
IntervalClock implements clock.Clock, but each invocation of Now steps the clock forward the specified duration
func (*IntervalClock) After ¶
func (*IntervalClock) After(d time.Duration) <-chan time.Time
After is unimplemented, will panic. TODO: make interval clock use FakeClock so this can be implemented.
func (*IntervalClock) NewTimer ¶
func (*IntervalClock) NewTimer(d time.Duration) clock.Timer
NewTimer is unimplemented, will panic. TODO: make interval clock use FakeClock so this can be implemented.
func (*IntervalClock) Since ¶
func (i *IntervalClock) Since(ts time.Time) time.Duration
Since returns time since the time in i.
func (*IntervalClock) Sleep ¶
func (*IntervalClock) Sleep(d time.Duration)
Sleep is unimplemented, will panic.