timeutil

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 2 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JitterPct

type JitterPct float64

JitterPct is a percent by which to scale a duration up or down. For example, 0.1 will result in +/- 10%.

func (JitterPct) Apply

func (p JitterPct) Apply(d time.Duration) time.Duration

type Ticker

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

Ticker is like time.Ticker, but with a variable period.

func NewTicker

func NewTicker(nextDur func() time.Duration) *Ticker

NewTicker returns a started Ticker which calls nextDur for each period. Ticker.Stop should be called to prevent goroutine leaks.

func (*Ticker) Reset

func (t *Ticker) Reset()

Reset starts a new period.

func (*Ticker) Stop

func (t *Ticker) Stop()

Stop permanently stops the Ticker. It cannot be Reset.

Jump to

Keyboard shortcuts

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