ticker

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: GPL-3.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ticker

type Ticker struct {
	C <-chan int
	// contains filtered or unexported fields
}

Ticker holds a channel that delivers ticks of a clock at intervals. The ticks are aligned to interval boundaries.

func New

func New(interval time.Duration) *Ticker

New returns a new Ticker containing a channel that will send the time with a period specified by the duration argument. It adjusts the intervals or drops ticks to make up for slow receivers. The duration must be greater than zero; if not, New will panic. Stop the Ticker to release associated resources.

func (*Ticker) Stop

func (t *Ticker) Stop()

Stop turns off a Ticker. After Stop, no more ticks will be sent. Stop does not close the channel, to prevent a read from the channel succeeding incorrectly.

Jump to

Keyboard shortcuts

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