timer

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RandTimer

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

func (*RandTimer) Channel

func (t *RandTimer) Channel() <-chan time.Time

func (*RandTimer) Reset

func (t *RandTimer) Reset(d time.Duration) bool

设置最小间隔

func (*RandTimer) Stop

func (t *RandTimer) Stop() bool

func (*RandTimer) Wait

func (t *RandTimer) Wait()

type Ticker

type Ticker time.Ticker

func (*Ticker) Channel

func (t *Ticker) Channel() <-chan time.Time

func (*Ticker) Reset

func (t *Ticker) Reset(d time.Duration) bool

func (*Ticker) Stop

func (t *Ticker) Stop() bool

func (*Ticker) Wait

func (t *Ticker) Wait()

type Timer

type Timer interface {
	Reset(time.Duration) bool
	Stop() bool

	Wait()

	Channel() <-chan time.Time
}

func NewRandTimer

func NewRandTimer(minInterval, maxInterval time.Duration) Timer

minInterval:最小等待时间 maxInterval:最大等待时间 maxInterval-minInterval: 等待范围

func NewTimer

func NewTimer(interval time.Duration) Timer

Jump to

Keyboard shortcuts

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