MCPcopy Index your code
hub / github.com/aceld/zinx / NewTimerAt

Function NewTimerAt

ztimer/timer.go:62–67  ·  view source on GitHub ↗

NewTimerAt 创建一个定时器,在指定的时间触发 定时器方法 df: DelayFunc类型的延迟调用函数类型;unixNano: unix计算机从1970-1-1至今经历的纳秒数

(df *DelayFunc, unixNano int64)

Source from the content-addressed store, hash-verified

60
61// NewTimerAt 创建一个定时器,在指定的时间触发 定时器方法 df: DelayFunc类型的延迟调用函数类型;unixNano: unix计算机从1970-1-1至今经历的纳秒数
62func NewTimerAt(df *DelayFunc, unixNano int64) *Timer {
63 return &Timer{
64 delayFunc: df,
65 unixts: unixNano / 1e6, //将纳秒转换成对应的毫秒 ms ,定时器以ms为最小精度
66 }
67}
68
69// NewTimerAfter 创建一个定时器,在当前时间延迟duration之后触发 定时器方法
70func NewTimerAfter(df *DelayFunc, duration time.Duration) *Timer {

Callers 2

NewTimerAfterFunction · 0.85
CreateTimerAtMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected