添加整点函数

This commit is contained in:
lifeiyi
2019-04-01 11:52:09 +08:00
parent 072502e11b
commit 311ed78c01

View File

@@ -13,6 +13,13 @@ func (slf *Timer) SetupTimer(ms int32) {
slf.timeinterval = int64(ms) * 1e6
}
func (slf *Timer) SetupTimerTheHour(ms int32) {
timeNow := time.Now()
nt := timeNow.Truncate(time.Hour * 1)
slf.lasttime = nt.UnixNano()
slf.timeinterval = int64(ms) * 1e6
}
func (slf *Timer) CheckTimeOut() bool {
now := time.Now().UnixNano()
if now-slf.lasttime > slf.timeinterval {