clock

package
v1.37.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ticker

type Ticker interface {
	Elapsed() <-chan time.Time
	Stop()
}

func NewTicker

func NewTicker(start time.Time, interval, jitter, offset time.Duration, align bool) Ticker

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer delivers ticks at regular but unaligned intervals.

Because the next interval is scheduled based on the interval + jitter, you are guaranteed at least interval seconds without missing a tick and ticks will be evenly scheduled over time.

On average you will have one collection each interval + (jitter/2).

The first tick is emitted after interval+jitter seconds.

Ticks are dropped for slow consumers.

func NewTimer

func NewTimer(interval, jitter time.Duration) *Timer

func (*Timer) Elapsed

func (t *Timer) Elapsed() <-chan time.Time

func (*Timer) Stop

func (t *Timer) Stop()

Jump to

Keyboard shortcuts

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