ticker

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package ticker implements tickers for the scheduler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ticker

type Ticker interface {
	// C returns the channel that ticks are sent on.
	C() <-chan time.Time
	// Stop stops the ticker.
	Stop()
}

Ticker describes the interface for tickers in this package.

func NewDaily

func NewDaily(clock clock.Clock, hour, minute int, tz *time.Location) Ticker

func NewPeriodic

func NewPeriodic(clock clock.Clock, period time.Duration) Ticker

NewPeriodic creates a new ticker based on the provided clock and with the provided period.

This ticker ticks at a given period like the standard library's ticker, but has an additional feature. Before sending the first tick it waits a random duration of time (but no more than the period). This means that ticks are smoothed out across different tickers started at the same time.

Jump to

Keyboard shortcuts

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