NowFunc returns a time provider function for t.
()
| 79 | |
| 80 | // NowFunc returns a time provider function for t. |
| 81 | func (t *ClockTimeWithOffset) NowFunc() func() time.Time { |
| 82 | return func() time.Time { |
| 83 | t.mu.Lock() |
| 84 | defer t.mu.Unlock() |
| 85 | |
| 86 | return clock.Now().Add(t.offset) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | // Advance increases the time offset by dt, such that the next call to |
| 91 | // t.NowFunc()() returns current time + new offset. |