You've already forked agentic-coding-workflow
feat(infra/clock): injectable Clock with Real and Fake implementations
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// Package clock provides an injectable time source. Production code uses Real();
|
||||
// tests use NewFake(t) to make time-based logic deterministic.
|
||||
package clock
|
||||
|
||||
import "time"
|
||||
|
||||
// Clock is the abstraction over the system clock. Implementations must be
|
||||
// safe for concurrent use.
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
}
|
||||
|
||||
type realClock struct{}
|
||||
|
||||
// Real returns a Clock backed by time.Now.
|
||||
func Real() Clock { return realClock{} }
|
||||
|
||||
func (realClock) Now() time.Time { return time.Now() }
|
||||
Reference in New Issue
Block a user