add NowUnixMilli NowUnixNano
This commit is contained in:
parent
17a44afd7c
commit
32919e76e1
16
app.go
16
app.go
@ -25,7 +25,7 @@ type App_ struct {
|
|||||||
chGoLoopTimerExit chan int
|
chGoLoopTimerExit chan int
|
||||||
chGoLoopWait chan int64
|
chGoLoopWait chan int64
|
||||||
nowTime time.Time
|
nowTime time.Time
|
||||||
nowUnix int64
|
nowUnixNano int64
|
||||||
imMsgHandlers [1024]func(int16,*q5.XParams)
|
imMsgHandlers [1024]func(int16,*q5.XParams)
|
||||||
maxRunDelay int64
|
maxRunDelay int64
|
||||||
maxScheduleTime int64
|
maxScheduleTime int64
|
||||||
@ -33,7 +33,7 @@ type App_ struct {
|
|||||||
|
|
||||||
func (this *App_) Init() {
|
func (this *App_) Init() {
|
||||||
this.nowTime = time.Now()
|
this.nowTime = time.Now()
|
||||||
atomic.StoreInt64(&this.nowUnix, this.nowTime.Unix())
|
atomic.StoreInt64(&this.nowUnixNano, this.nowTime.UnixNano())
|
||||||
_Timer = &q5.Timer{}
|
_Timer = &q5.Timer{}
|
||||||
_Timer.Init(
|
_Timer.Init(
|
||||||
func (context interface{}) int64 {
|
func (context interface{}) int64 {
|
||||||
@ -81,7 +81,7 @@ func (this *App_) UnInit() {
|
|||||||
func (this *App_) Run() {
|
func (this *App_) Run() {
|
||||||
for !this.terminated {
|
for !this.terminated {
|
||||||
this.nowTime = time.Now()
|
this.nowTime = time.Now()
|
||||||
atomic.StoreInt64(&this.nowUnix, this.nowTime.Unix())
|
atomic.StoreInt64(&this.nowUnixNano, this.nowTime.UnixNano())
|
||||||
|
|
||||||
beginTick := q5.GetTickCount()
|
beginTick := q5.GetTickCount()
|
||||||
_Timer.Update()
|
_Timer.Update()
|
||||||
@ -173,7 +173,15 @@ func (this *App_) schedule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *App_) NowUnix() int64 {
|
func (this *App_) NowUnix() int64 {
|
||||||
return this.nowUnix
|
return this.nowUnixNano / int64(time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *App_) NowUnixMilli() int64 {
|
||||||
|
return this.nowUnixNano / int64(time.Millisecond)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *App_) NowUnixNano() int64 {
|
||||||
|
return this.nowUnixNano
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *App_) outputRuningLog() {
|
func (this *App_) outputRuningLog() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user