clock

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Overview

Package clock abstracts time so that embedded targets can inject a hardware RTC or monotonic counter, and tests can use a deterministic fake clock.

All server and BMC state-machine code must obtain time exclusively through this interface – never via time.Now directly.

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
	NewTimer(d time.Duration) Timer
	NewTicker(d time.Duration) Ticker
}

Clock provides the current time and factory methods for timers/tickers.

var Real Clock = realClock{}

Real is the standard Clock implementation backed by the time package.

type Ticker

type Ticker interface {
	C() <-chan time.Time
	Stop()
}

Ticker mirrors the relevant subset of time.Ticker.

type Timer

type Timer interface {
	C() <-chan time.Time
	Stop() bool
	Reset(d time.Duration) bool
}

Timer mirrors the relevant subset of time.Timer.

Jump to

Keyboard shortcuts

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