diff --git a/app.go b/app.go index 58f1f73..2168a40 100644 --- a/app.go +++ b/app.go @@ -3,6 +3,7 @@ package f5 import ( "flag" "sync" + "sync/atomic" "time" "os" "q5" @@ -24,6 +25,7 @@ type App_ struct { chGoLoopTimerExit chan int chGoLoopWait chan int64 nowTime time.Time + nowUnix int64 imMsgHandlers [1024]func(int16,*q5.XParams) maxRunDelay int64 maxScheduleTime int64 @@ -31,6 +33,7 @@ type App_ struct { func (this *App_) Init() { this.nowTime = time.Now() + atomic.StoreInt64(&this.nowUnix, this.nowTime.Unix()) _Timer = &q5.Timer{} _Timer.Init( func (context interface{}) int64 { @@ -78,6 +81,7 @@ func (this *App_) UnInit() { func (this *App_) Run() { for !this.terminated { this.nowTime = time.Now() + atomic.StoreInt64(&this.nowUnix, this.nowTime.Unix()) beginTick := q5.GetTickCount() _Timer.Update() @@ -169,7 +173,7 @@ func (this *App_) schedule() { } func (this *App_) NowUnix() int64 { - return this.nowTime.Unix() + return this.nowUnix } func (this *App_) outputRuningLog() {