timewheel

package
v0.0.0-...-ff803ae Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GRANULARITY int64 = 10 //定时器的最小单位,每格10ms

分别用位代表每个轮存在的轮子数(2^6,2^6,...2^8) -------------------------- | 6 | 6 | 6 | 6 | 8 | -------------------------- 根据游戏定时器,将第一轮控制在12位,即40960ms以内。

Functions

func GetNow

func GetNow() int64

获取当前时间戳ms

func ReleaseTimer

func ReleaseTimer(timer *Timer)

Types

type Timer

type Timer struct {
	C            chan *Timer //定时器管道
	AdditionData interface{} //定时器附加数据
	// contains filtered or unexported fields
}

定时器结构体

func NewTimer

func NewTimer(d time.Duration) *Timer

func NewTimerEx

func NewTimerEx(d time.Duration, c chan *Timer, additionData interface{}) *Timer

func (*Timer) Close

func (timer *Timer) Close()

停止停时器

func (*Timer) IsClose

func (timer *Timer) IsClose() bool

定时器是否已经停止

func (*Timer) IsEnd

func (timer *Timer) IsEnd() bool

Jump to

Keyboard shortcuts

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