Skip to content

Commit 25876e8

Browse files
committed
Make comparisons with distantFuture work as expected
1 parent f6fbd11 commit 25876e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/swift/Time.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public struct DispatchTime : Comparable {
4747
}
4848

4949
public func <(a: DispatchTime, b: DispatchTime) -> Bool {
50-
if a.rawValue == ~0 || b.rawValue == ~0 { return false }
5150
return a.rawValue < b.rawValue
5251
}
5352

@@ -75,7 +74,11 @@ public struct DispatchWallTime : Comparable {
7574
}
7675

7776
public func <(a: DispatchWallTime, b: DispatchWallTime) -> Bool {
78-
if a.rawValue == ~0 || b.rawValue == ~0 { return false }
77+
if b.rawValue == ~0 {
78+
return a.rawValue != ~0
79+
} else if a.rawValue == ~0 {
80+
return false
81+
}
7982
return -Int64(bitPattern: a.rawValue) < -Int64(bitPattern: b.rawValue)
8083
}
8184

0 commit comments

Comments
 (0)