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

Function WithClock

pkg/session/session.go:891–895  ·  view source on GitHub ↗

WithClock injects the time source used for the session's CreatedAt, for timestamping messages it generates (summaries, compaction input), and for messages added through WithUserMessage/WithSystemMessage/ WithImplicitUserMessage. Because those message options read the clock when they run, WithClock m

(now func() time.Time)

Source from the content-addressed store, hash-verified

889// ordering). Primarily for tests that need a deterministic clock; production
890// code leaves it unset and falls back to time.Now.
891func WithClock(now func() time.Time) Opt {
892 return func(s *Session) {
893 s.clock = now
894 }
895}
896
897// WithIDGen injects the generator used to mint the session ID when no explicit
898// ID is provided. Primarily for tests that need deterministic IDs; production

Calls

no outgoing calls