MCPcopy
hub / github.com/tailscale/tailscale / Now

Method Now

tstest/clock.go:144–159  ·  view source on GitHub ↗

Now returns the virtual clock's current time, and advances it according to its step configuration.

()

Source from the content-addressed store, hash-verified

142// Now returns the virtual clock's current time, and advances it
143// according to its step configuration.
144func (c *Clock) Now() time.Time {
145 c.init()
146 rt := c.maybeGetRealTime()
147
148 c.mu.Lock()
149 defer c.mu.Unlock()
150
151 step := c.step
152 if c.skipStep {
153 step = 0
154 c.skipStep = false
155 }
156 c.advanceLocked(rt, step)
157
158 return c.present
159}
160
161func (c *Clock) maybeGetRealTime() time.Time {
162 if c.realTimeClock == nil {

Callers 15

testControlHTTPFunction · 0.95
TestRateLoggerFunction · 0.95
TestProxyGroupFunction · 0.95
TestProxyClassFunction · 0.95
TestPingerFunction · 0.95
TestV6PingerFunction · 0.95
TestPingerMismatchFunction · 0.95

Implementers 3

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

Calls 5

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

Tested by 15

testControlHTTPFunction · 0.76
TestRateLoggerFunction · 0.76
TestProxyGroupFunction · 0.76
TestProxyClassFunction · 0.76
TestPingerFunction · 0.76
TestV6PingerFunction · 0.76
TestPingerMismatchFunction · 0.76