mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-01 16:50:33 +00:00
Fixed background aware timer
This commit is contained in:
@@ -57,7 +57,7 @@ public func suspendAwareDelay<T, E>(_ timeout: Double, granularity: Double = 4.0
|
||||
var invalidateImpl: (() -> Void)?
|
||||
let timer = Timer(timeout: granularity, repeat: true, completion: {
|
||||
let currentTimestamp = CFAbsoluteTimeGetCurrent()
|
||||
if beginTimestamp + timeout >= currentTimestamp - granularity * 1.1 {
|
||||
if beginTimestamp + timeout - granularity * 1.1 <= currentTimestamp {
|
||||
invalidateImpl?()
|
||||
startFinalTimer()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user