Help us shape the future of Go! Take the 2026 Go Developer Survey

clock

package
v1.0.0-rc.12 Latest Latest
Warning

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

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

Documentation

Overview

Package clock is where an owner's real clock comes from. An owner reads the time only through a now func() time.Time it was given, so a test can set the time; Or gives it the real clock when it was given none. System is the one named exception. This is the one package the clock rule (.golangci.yml) lets name time.Now.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Or

func Or(now func() time.Time) func() time.Time

Or is now, or the real clock when now is nil.

func System

func System() time.Time

System is the operating system's clock, for comparing with a time the operating system stamped: a file's modification time. That is its only legitimate use. A time an owner writes or judges comes from the owner's clock (Or), which a test can move; a file's mtime cannot be moved with it.

Types

This section is empty.

Directories

Path Synopsis
Package clocktest holds a clock for tests that must see how often an operation reads its owner's clock.
Package clocktest holds a clock for tests that must see how often an operation reads its owner's clock.

Jump to

Keyboard shortcuts

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