deadline or wallDeadline to dispatch after?

iOS 10.0 beta 4 replaced after(when:, execute:) in class DispatchQueue by two alternatives:

    public func asyncAfter(deadline: DispatchTime, execute: DispatchWorkItem)
    public func asyncAfter(wallDeadline: DispatchWallTime, execute: DispatchWorkItem)

and a similar pair of functions with more options.


I could not find a documentation for the difference, does anybody know? I need it for a speech app, so individual milliseconds do not matter, but several tens or even hundreds of milliseconds might.

Accepted Reply

These two links explain the difference I think:

https://forums.developer.apple.com/thread/49361

stackoverflow.com/questions/26062702/what-is-the-difference-between-dispatch-time-and-dispatch-walltime-and-in-what-s

Replies

The naming change is to clarify that asyncAfter is not exact. The async method will fire some time after the deadline occurs.

The naming change is obvious. My question is about the difference between a deadline and a wallDeadline. Both struct DispatchTime and struct DispatchWallTime look identical to me. Why do they warrant all this duplicate functions, and which gives me the best chance of avoiding surprises?

These two links explain the difference I think:

https://forums.developer.apple.com/thread/49361

stackoverflow.com/questions/26062702/what-is-the-difference-between-dispatch-time-and-dispatch-walltime-and-in-what-s

Thanks, that's exactly the answer I was looking for. Some of my uses will need to tolerate sleep, so I'll switch to the DispatchWallTime version.