This commit is contained in:
boyce
2019-04-01 15:31:42 +08:00

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 {