Skip to content

Commit a166a8d

Browse files
committed
Mark DispatchTimeInterval Equatable
We can mark `DispatchTimeInterval` as equatable because it already implements the equality check operator `==`. Doing this will allow DispatchTimeInterval to be used with a wide range of library functions which are defined to operate on Equatable objects. For example this is useful in tests when you might which to use `XCTAssertEqual`.
1 parent 6242e80 commit a166a8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/swift/Time.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private func toInt64Clamped(_ value: Double) -> Int64 {
165165
/// let t1 = DispatchTimeInterval.seconds(Int.max)
166166
/// let t2 = DispatchTimeInterval.milliseconds(Int.max)
167167
/// let result = t1 == t2 // true
168-
public enum DispatchTimeInterval {
168+
public enum DispatchTimeInterval: Equatable {
169169
case seconds(Int)
170170
case milliseconds(Int)
171171
case microseconds(Int)

0 commit comments

Comments
 (0)