timer

package
v0.0.0-...-6785f5e Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ScanSecondDurationDefault      = time.Millisecond * 100 // 定时器扫描间隔-默认. 100ms
	ScanMillisecondDurationDefault = time.Millisecond * 25  // 定时器扫描间隔-默认. 25ms
)

Functions

func NewOptions

func NewOptions() *options

NewOptions 新的Options

func SetTimestampOffset

func SetTimestampOffset(offset int64)

SetTimestampOffset 设置时间戳偏移量

func ShadowTimestamp

func ShadowTimestamp() int64

ShadowTimestamp 叠加偏移量的时间戳-秒

Types

type EventTimerMillisecond

type EventTimerMillisecond struct {
	ISwitch   xcontrol.ISwitchButton
	ICallBack xcontrol.ICallBack
}

type EventTimerSecond

type EventTimerSecond struct {
	ISwitch   xcontrol.ISwitchButton
	ICallBack xcontrol.ICallBack
}

type ITimer

type ITimer interface {
	Start(ctx context.Context, opts ...*options) error
	Stop()
	ITimerSecond
	ITimerMillisecond
}

func NewTimer

func NewTimer() ITimer

type ITimerMillisecond

type ITimerMillisecond interface {
	AddMillisecond(callBackFunc xcontrol.ICallBack, expireMillisecond int64) *millisecond
	DelMillisecond(millisecond *millisecond)
}

type ITimerSecond

type ITimerSecond interface {
	AddSecond(callBackFunc xcontrol.ICallBack, expire int64) *Second
	DelSecond(second *Second)
}

type Second

type Second struct {
	ISwitch   xcontrol.ISwitchButton // 有效(false:不执行,扫描时自动删除)
	ICallBack xcontrol.ICallBack     // 回调
	// contains filtered or unexported fields
}

Second 秒级定时器

Jump to

Keyboard shortcuts

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