MCPcopy Create free account
hub / github.com/dropbox/godropbox / Set

Method Set

time2/mock_clock.go:53–62  ·  view source on GitHub ↗

Set the mock clock to a specific time. NOTE: scheduled wakeup calls are not modified when resetting the clock to an earlier time; for example, suppose the current time is X, and there is a pending wakeup call at time X+1. If we reset the clock to X-2, the wakeup time will still be at X+1.

(t time.Time)

Source from the content-addressed store, hash-verified

51// the current time is X, and there is a pending wakeup call at time X+1. If
52// we reset the clock to X-2, the wakeup time will still be at X+1.
53func (c *MockClock) Set(t time.Time) {
54 c.mutex.Lock()
55 defer c.mutex.Unlock()
56
57 if t.After(c.now) {
58 c.advanceTo(t)
59 } else {
60 c.now = t // move back in time
61 }
62}
63
64// Advances the mock clock by the specified duration.
65func (c *MockClock) Advance(delta time.Duration) {

Callers 1

NewMockClockFunction · 0.95

Calls 4

advanceToMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65
AfterMethod · 0.65

Tested by

no test coverage detected