AdvanceTo moves simulated time to a new absolute value. Any Timer or Ticker that is waiting will fire at the requested point in simulated time. If this Clock follows real time then the next call to Now will equal t + the elapsed time since calling Advance. Otherwise, the next call to Now will equal
(t time.Time)
| 210 | // time since calling Advance. Otherwise, the next call to Now will equal t, |
| 211 | // regardless of the configured step. |
| 212 | func (c *Clock) AdvanceTo(t time.Time) { |
| 213 | c.init() |
| 214 | rt := c.maybeGetRealTime() |
| 215 | |
| 216 | c.mu.Lock() |
| 217 | defer c.mu.Unlock() |
| 218 | c.skipStep = true |
| 219 | c.realTime = rt |
| 220 | c.present = t |
| 221 | c.events.AdvanceTo(c.present) |
| 222 | } |
| 223 | |
| 224 | // GetStart returns the initial simulated time when this Clock was created. |
| 225 | func (c *Clock) GetStart() time.Time { |