clock

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package clock is the canonical injected-dependency example (ADR-0002). It provides the Clock interface so components can be tested with a deterministic fake instead of wall-clock time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock is the port for time operations. Components depend on this interface; the app injects System() in production and a Fake in tests.

func Fake

func Fake(t time.Time) Clock

Fake returns a clock fixed at the given time — useful for deterministic tests.

func System

func System() Clock

System returns the real-time clock.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL