MCPcopy Index your code
hub / github.com/docker/docker-agent / WithClock

Function WithClock

pkg/runtime/runtime.go:440–446  ·  view source on GitHub ↗

WithClock replaces the runtime's clock. Defaults to time.Now. Tests that need deterministic timestamps (assistant message CreatedAt, fallback cooldown windows, tool-call latency) can pass a fake clock so assertions don't depend on wall-clock advancement.

(now func() time.Time)

Source from the content-addressed store, hash-verified

438// cooldown windows, tool-call latency) can pass a fake clock so assertions
439// don't depend on wall-clock advancement.
440func WithClock(now func() time.Time) Opt {
441 return func(r *LocalRuntime) {
442 if now != nil {
443 r.now = now
444 }
445 }
446}
447
448// WithTelemetry replaces the runtime's Telemetry sink. Defaults to a
449// pass-through to the package-level pkg/telemetry helpers. Tests pass a

Calls

no outgoing calls