MCPcopy
hub / github.com/uber-go/zap / MockClock

Struct MockClock

internal/ztest/clock.go:34–43  ·  internal/ztest/clock.go::MockClock

MockClock is a fake source of time. It implements standard time operations, but allows the user to control the passage of time. Use the [Add] method to progress time.

Source from the content-addressed store, hash-verified

32//
33// Use the [Add] method to progress time.
34type MockClock struct {
35 mu sync.RWMutex
36 now time.Time
37
38 // The MockClock works by maintaining a list of waiters.
39 // Each waiter knows the time at which it should be resolved.
40 // When the clock advances, all waiters that are in range are resolved
41 // in chronological order.
42 waiters []waiter
43}
44
45// NewMockClock builds a new mock clock
46// using the current actual time as the initial time.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected