MCPcopy Index your code
hub / github.com/tailscale/tailscale / AdvanceTo

Method AdvanceTo

tstest/clock.go:212–222  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

210// time since calling Advance. Otherwise, the next call to Now will equal t,
211// regardless of the configured step.
212func (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.
225func (c *Clock) GetStart() time.Time {

Callers 3

TestClockFollowRealTimeFunction · 0.45
initMethod · 0.45
advanceLockedMethod · 0.45

Implementers 3

DefaultClocktstime/tstime.go
StdClocktstime/tstime.go
Clocktstest/clock.go

Calls 4

initMethod · 0.95
maybeGetRealTimeMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65

Tested by 1

TestClockFollowRealTimeFunction · 0.36