Documentation
¶
Overview ¶
Package clock abstracts the current time so production code can use the real system clock while tests inject a controllable fake.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
Clock provides the current time. Production code depends on this interface, never on time.Now directly, so tests can substitute Fake. Now always returns a time.Time in UTC — callers can rely on this and don't need to call .UTC() themselves, though doing so is harmless.
type Fake ¶
type Fake struct {
// contains filtered or unexported fields
}
Fake is a controllable Clock for tests. Set and Advance let a test drive time deterministically instead of sleeping or tolerating a fuzzy window. Like Real, it normalizes every instant to UTC, so Clock's "Now() is always UTC" contract holds regardless of which implementation is in use.