clock

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package clock injects time into the CLI so that relative output, `--since` windows, token-expiry checks and retention pruning are deterministic in tests (PLAN.md, Layer 1: "an injected clock keeps relative times and --since deterministic").

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 seam every package takes instead of calling time.Now directly.

func New

func New() Clock

New returns the real clock.

type Fake

type Fake struct {
	// contains filtered or unexported fields
}

Fake is a manually advanced clock for tests.

func NewFake

func NewFake(t time.Time) *Fake

NewFake returns a clock frozen at t (UTC).

func (*Fake) Advance

func (f *Fake) Advance(d time.Duration)

Advance moves the clock forward by d.

func (*Fake) Now

func (f *Fake) Now() time.Time

Now returns the frozen time.

func (*Fake) Set

func (f *Fake) Set(t time.Time)

Set moves the clock to t.

type System

type System struct{}

System is the real clock.

func (System) Now

func (System) Now() time.Time

Now returns the current local time.

Jump to

Keyboard shortcuts

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