Skip to content

Commit fb8868f

Browse files
committed
fixup
1 parent 4cc8059 commit fb8868f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Sources/Basics/DispatchTimeInterval+Extensions.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,12 @@ extension DispatchTimeInterval {
5757
}
5858
}
5959
}
60+
61+
#if os(Linux)
62+
extension DispatchTime {
63+
public func distance(to: DispatchTime) -> DispatchTimeInterval {
64+
let duration = self.uptimeNanoseconds - to.uptimeNanoseconds
65+
return .nanoseconds(duration >= Int.max ? Int.max : Int(duration))
66+
}
67+
}
68+
#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)