mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
添加整点函数
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user