timer

package
v0.0.0-...-f94ef0f Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HV

type HV struct {
	Height uint32
	View   byte
}

HV is a pair of a Height and a View.

type Timer

type Timer interface {
	// Now returns current time.
	Now() time.Time
	// Reset
	Reset(s HV, d time.Duration)
	// Sleep stops execution for duration d.
	Sleep(d time.Duration)
	// Extend extends current timer with duration d.
	Extend(d time.Duration)
	// Stop stops timer.
	Stop()
	// HV returns current height and view set for the timer.
	HV() HV
	// C returns channel for timer events.
	C() <-chan time.Time
}

Timer is an interface which implements all time-related functions. It can be mocked for testing.

func New

func New() Timer

New returns default Timer implementation.

Jump to

Keyboard shortcuts

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