NewTimer returns a Timer that uses this Clock for accessing the current time.
(d time.Duration)
| 276 | // NewTimer returns a Timer that uses this Clock for accessing the current |
| 277 | // time. |
| 278 | func (c *Clock) NewTimer(d time.Duration) (tstime.TimerController, <-chan time.Time) { |
| 279 | c.init() |
| 280 | rt := c.maybeGetRealTime() |
| 281 | |
| 282 | c.mu.Lock() |
| 283 | defer c.mu.Unlock() |
| 284 | |
| 285 | c.advanceLocked(rt, 0) |
| 286 | t := &Timer{ |
| 287 | nextTrigger: c.present.Add(d), |
| 288 | em: &c.events, |
| 289 | } |
| 290 | t.init(c.timerChannelSize, nil) |
| 291 | return t, t.C |
| 292 | } |
| 293 | |
| 294 | // AfterFunc returns a Timer that calls f when it fires, using this Clock for |
| 295 | // accessing the current time. |
nothing calls this directly
no test coverage detected