Releases: antlabs/timer
Releases · antlabs/timer
Release list
v0.1.4版本
v0.1.3版本
v0.1.2版本
v0.1.1版本
v0.0.12版本
v0.0.11版本
v0.0.10版本
v0.0.9版本
v0.0.8版本
v0.0.7版本
自定义周期性定时器
实现时间翻倍定时的例子
type curstomTest struct {
count int
}
// 只要实现Next接口就行
func (c *curstomTest) Next(now time.Time) (rv time.Time) {
rv = now.Add(time.Duration(c.count) * time.Millisecond * 10)
c.count++
return
}
func main() {
tm := timer.NewTimer(timer.WithMinHeap())
node := tm.CustomFunc(&curstomTest{count: 1}, func() {
log.Printf("%v\n", time.Now())
})
tm.Run()
}