2
2
//
3
3
// This source file is part of the Swift.org open source project
4
4
//
5
- // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5
+ // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6
6
// Licensed under Apache License v2.0 with Runtime Library Exception
7
7
//
8
8
// See http://swift.org/LICENSE.txt for license information
@@ -78,13 +78,14 @@ public struct DispatchTime : Comparable {
78
78
}
79
79
}
80
80
81
- public func < ( a : DispatchTime , b : DispatchTime ) -> Bool {
82
- if a . rawValue == ~ 0 || b . rawValue == ~ 0 { return false }
83
- return a. rawValue < b. rawValue
84
- }
81
+ extension DispatchTime {
82
+ public static func < ( a : DispatchTime , b : DispatchTime ) -> Bool {
83
+ return a. rawValue < b. rawValue
84
+ }
85
85
86
- public func == ( a: DispatchTime , b: DispatchTime ) -> Bool {
87
- return a. rawValue == b. rawValue
86
+ public static func == ( a: DispatchTime , b: DispatchTime ) -> Bool {
87
+ return a. rawValue == b. rawValue
88
+ }
88
89
}
89
90
90
91
public struct DispatchWallTime : Comparable {
@@ -106,17 +107,20 @@ public struct DispatchWallTime : Comparable {
106
107
}
107
108
}
108
109
109
- public func < ( a: DispatchWallTime , b: DispatchWallTime ) -> Bool {
110
- if b. rawValue == ~ 0 {
111
- return a. rawValue != ~ 0
112
- } else if a. rawValue == ~ 0 {
113
- return false
110
+ extension DispatchWallTime {
111
+ public static func < ( a: DispatchWallTime , b: DispatchWallTime ) -> Bool {
112
+ let negativeOne : dispatch_time_t = ~ 0
113
+ if b. rawValue == negativeOne {
114
+ return a. rawValue != negativeOne
115
+ } else if a. rawValue == negativeOne {
116
+ return false
117
+ }
118
+ return - Int64( bitPattern: a. rawValue) < - Int64( bitPattern: b. rawValue)
114
119
}
115
- return - Int64( bitPattern: a. rawValue) < - Int64( bitPattern: b. rawValue)
116
- }
117
120
118
- public func == ( a: DispatchWallTime , b: DispatchWallTime ) -> Bool {
119
- return a. rawValue == b. rawValue
121
+ public static func == ( a: DispatchWallTime , b: DispatchWallTime ) -> Bool {
122
+ return a. rawValue == b. rawValue
123
+ }
120
124
}
121
125
122
126
public enum DispatchTimeInterval {
0 commit comments