File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
stdlib/public/SDK/Dispatch Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ public struct DispatchWallTime : Comparable {
74
74
75
75
public func < ( a: DispatchWallTime , b: DispatchWallTime ) -> Bool {
76
76
if a. rawValue == ~ 0 || b. rawValue == ~ 0 { return false }
77
- return - Int64( a. rawValue) < - Int64( b. rawValue)
77
+ return - Int64( bitPattern : a. rawValue) < - Int64( bitPattern : b. rawValue)
78
78
}
79
79
80
80
public func == ( a: DispatchWallTime , b: DispatchWallTime ) -> Bool {
Original file line number Diff line number Diff line change @@ -85,3 +85,19 @@ DispatchAPI.test("dispatch_data_t deallocator") {
85
85
expectEqual ( 1 , t)
86
86
}
87
87
}
88
+
89
+ DispatchAPI . test ( " DispatchTime comparisons " ) {
90
+ do {
91
+ let now = DispatchTime . now ( )
92
+ checkComparable ( [ now, now + . milliseconds( 1 ) ] , oracle: {
93
+ return $0 < $1 ? . lt : $0 == $1 ? . eq : . gt
94
+ } )
95
+ }
96
+
97
+ do {
98
+ let now = DispatchWallTime . now ( )
99
+ checkComparable ( [ now, now + . milliseconds( 1 ) ] , oracle: {
100
+ return $0 < $1 ? . lt : $0 == $1 ? . eq : . gt
101
+ } )
102
+ }
103
+ }
You can’t perform that action at this time.
0 commit comments