Skip to content

Commit d438a67

Browse files
committed
fixup
1 parent 4cc8059 commit d438a67

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Sources/Basics/DispatchTimeInterval+Extensions.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,13 @@ extension DispatchTimeInterval {
5757
}
5858
}
5959
}
60+
61+
// remove when available to all platforms
62+
#if os(Linux) || os(Windows) || os(Android)
63+
extension DispatchTime {
64+
public func distance(to: DispatchTime) -> DispatchTimeInterval {
65+
let duration = to.uptimeNanoseconds - self.uptimeNanoseconds
66+
return .nanoseconds(duration >= Int.max ? Int.max : Int(duration))
67+
}
68+
}
69+
#endif

Sources/Commands/SwiftTool.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,10 @@ extension DispatchTimeInterval {
937937
return String(format: "%.2f", Double(value)/Double(1_000_000_000)) + "s"
938938
case .never:
939939
return "n/a"
940+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
940941
@unknown default:
941942
return "n/a"
943+
#endif
942944
}
943945
}
944946
}

0 commit comments

Comments
 (0)