Swift计时器未在准确时间执行

时间:2019-04-11 11:33:33

标签: swift macos

我们每60秒记录一次事件,但是有些事件并不准确。

这是事件日志:-

  

种子==== 2019-04-11T14:51:09

     

种子==== 2019-04-11T14:52:09

     

种子==== 2019-04-11T14:53:09

     

种子==== 2019-04-11T14:54:19

     

种子==== 2019-04-11T14:55:09

     

种子==== 2019-04-11T14:56:09

     

种子==== 2019-04-11T14:57:09

我们将不正确的事件加粗了。

self.sessionTimer = Timer.scheduledTimer(withTimeInterval: 
TimeInterval(self.eventDuration), repeats: true, block: { (timer) in

print("seeesion ==== \(Formatter.preciseLocalTime.string(from:Date()))")

})

0 个答案:

没有答案
相关问题