On Linux (Ubuntu 16.04) and swift distributions from 3.0.2 to the latest 4.0 snapshot, I’m seeing incorrect behaviour involving DispatchTime.distantFuture:
(also: https://bugs.swift.org/browse/SR-5706\)
···
***
import Dispatch
let now = DispatchTime.now()
let future = DispatchTime.distantFuture
assert(now != future, "this is not the distant future")
Could this operator func somehow be called correctly during testing, but incorrectly at runtime?
(In other words, I don’t see where the fix needs to be.)
Without going into details, it looks like the Swift wrappers for dispatch_time_t are very, very broken. In short, dispatch_time_t (in the C world) is intentionally documented as an opaque type, but the Swift wrappers assume otherwise and jump to wrong conclusions about the implementation of the type. What this means in practice is that you should avoid the DispatchTime comparison APIs for now.
Dave
···
On Aug 26, 2017, at 15:21, Guillaume Lessard via swift-dev <swift-dev@swift.org> wrote:
On Linux (Ubuntu 16.04) and swift distributions from 3.0.2 to the latest 4.0 snapshot, I’m seeing incorrect behaviour involving DispatchTime.distantFuture:
(also: https://bugs.swift.org/browse/SR-5706\)
***
import Dispatch
let now = DispatchTime.now()
let future = DispatchTime.distantFuture
assert(now != future, "this is not the distant future")
Could this operator func somehow be called correctly during testing, but incorrectly at runtime?
(In other words, I don’t see where the fix needs to be.)
Without going into details, it looks like the Swift wrappers for dispatch_time_t are very, very broken. In short, dispatch_time_t (in the C world) is intentionally documented as an opaque type, but the Swift wrappers assume otherwise and jump to wrong conclusions about the implementation of the type. What this means in practice is that you should avoid the DispatchTime comparison APIs for now.
In any event, the DispatchTime and DispatchWallTime wrappers do not let you initialize them from a raw value and, as such, avoid the duality of dispatch_time_t.