(d time.Duration)
| 104 | } |
| 105 | |
| 106 | func (c *MockClock) After(d time.Duration) <-chan time.Time { |
| 107 | c.mutex.Lock() |
| 108 | defer c.mutex.Unlock() |
| 109 | |
| 110 | w := &wakeup{ |
| 111 | t: c.now.Add(d), |
| 112 | c: make(chan time.Time), |
| 113 | } |
| 114 | c.logf("MockClock: registering wakeup in %s at %s.", d.String(), tsStr(w.t)) |
| 115 | heap.Push(&c.wakeups, w) |
| 116 | return w.c |
| 117 | } |
| 118 | |
| 119 | func (c *MockClock) Sleep(d time.Duration) { |
| 120 | <-c.After(d) |