{"modulePath":"github.com/omniviewdev/plugin-sdk","version":"v0.25.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package timeutil\n\nPackage timeutil provides shared time abstractions for deterministic testing.\n\n## Types\n\n```go\ntype Clock interface {\n\tNow() time.Time\n\tAfter(d time.Duration) \u003c-chan time.Time\n}\n```\nClock abstracts time operations so production code uses real time and tests can inject controllable fakes.\n\n```go\ntype FakeClock struct {\n\t// contains filtered or unexported fields\n}\n```\nFakeClock implements Clock for deterministic testing. Use Advance() to manually progress time and fire pending timers, or use NewInstantFakeClock() for tests that just need zero-delay After().\n\n```go\nfunc NewFakeClock() *FakeClock\n```\nNewFakeClock creates a FakeClock anchored to a fixed time. After() calls register timers that fire when Advance() is called.\n\n```go\nfunc NewInstantFakeClock() *FakeClock\n```\nNewInstantFakeClock creates a FakeClock where After() returns immediately. Useful for tests that just need to eliminate delays without controlling timing.\n\n```go\nfunc (c *FakeClock) Advance(d time.Duration)\n```\nAdvance progresses time by d, firing any timers that expire.\n\n```go\nfunc (c *FakeClock) After(d time.Duration) \u003c-chan time.Time\n```\nAfter returns a channel that fires when Advance() progresses past the duration. In instant mode (NewInstantFakeClock), the channel fires immediately.\n\n```go\nfunc (c *FakeClock) Now() time.Time\n```\nNow returns the fake clock's current time.\n\n```go\nfunc (c *FakeClock) PendingTimers() int\n```\nPendingTimers returns the number of timers waiting to fire.\n\n```go\nfunc (c *FakeClock) WaitForTimers(ctx context.Context, n int) error\n```\nWaitForTimers blocks until at least n timers are pending, or ctx is cancelled.\n\n```go\ntype RealClock struct{}\n```\nRealClock delegates to the standard time package.\n\n```go\nfunc (RealClock) After(d time.Duration) \u003c-chan time.Time\n```\nAfter returns a channel that receives once after d; nonpositive durations fire immediately.\n\n```go\nfunc (RealClock) Now() time.Time\n```\nNow returns the current wall-clock time, including the standard library's monotonic reading.\n\n","path":"github.com/omniviewdev/plugin-sdk/pkg/utils/timeutil","name":"timeutil","synopsis":"Package timeutil provides shared time abstractions for deterministic testing.","isRedistributable":true}
