clock

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package clock gives the commands the system time, pauses and jitter that the use cases take as ports, so the use cases stay testable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Jitter

func Jitter(bound time.Duration) time.Duration

Jitter returns a random duration in [0, bound), or 0 when bound is not positive.

Types

type System

type System struct{}

System is the system clock.

func (System) Now

func (System) Now() time.Time

Now returns the current time.

func (System) Sleep

func (System) Sleep(ctx context.Context, d time.Duration) error

Sleep returns after d, or with the error of ctx once it is done.

Jump to

Keyboard shortcuts

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