clock

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package clock provides primitives for mocking time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	// After waits for the duration to elapse and then sends the current time on the returned channel.
	After(duration time.Duration) <-chan time.Time

	// NewTicker returns a new Ticker.
	NewTicker(d time.Duration) Ticker

	// Now returns the current local time.
	Now() time.Time
}

Clock provides capabilities from the time standard library package.

func System

func System() Clock

System returns a Clock implementation that delegate to the time package.

type Ticker

type Ticker interface {
	// C returns the channel on which the ticks are delivered.
	C() <-chan time.Time

	// Stop the Ticker.
	Stop()
}

Ticker wraps the time.Ticker class.

Jump to

Keyboard shortcuts

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