clock

package
v1.38.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 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 Option added in v1.38.0

type Option func(*config)

func WithAlignment added in v1.38.0

func WithAlignment(start time.Time) Option

func WithClock added in v1.38.0

func WithClock(clk clock.Clock) Option

func WithStartupNotification added in v1.38.0

func WithStartupNotification(notifier chan bool) Option

type Ticker

type Ticker struct {
	C chan time.Time
	// contains filtered or unexported fields
}

func NewTicker

func NewTicker(interval, jitter, offset time.Duration, opt ...Option) *Ticker

func (*Ticker) Stop

func (t *Ticker) Stop()

type Timer

type Timer struct {
	C chan time.Time
	// 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, opt ...Option) *Timer

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