// Clock represents the passage of time in a way that// can be faked out for tests.type Clock interface{// Now returns the current time.Now() time.Time
// Sleep sleeps for at least the given duration.Sleep(d time.Duration)}// realClock implements Clock in terms of standard time functions.type realClock struct{}// Now implements Clock.Now by calling time.Now.func(realClock)Now() time.Time {return time.Now()}// Now implements Clock.Sleep by calling time.Sleep.func(realClock)Sleep(d time.Duration){
time.Sleep(d)}