|
|
@@ -14,12 +14,16 @@
|
|
|
* limitations under the License.
|
|
|
*/
|
|
|
|
|
|
-#if swift(<5.8)
|
|
|
+#if swift(<5.9)
|
|
|
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
|
|
|
extension Task where Success == Never, Failure == Never {
|
|
|
@inlinable
|
|
|
- static func sleep(for duration: Duration, clock: ContinuousClock) async throws {
|
|
|
- try await Self.sleep(for: duration)
|
|
|
+ static func sleep<C: Clock>(
|
|
|
+ for duration: C.Instant.Duration,
|
|
|
+ tolerance: C.Instant.Duration? = nil,
|
|
|
+ clock: C = ContinuousClock()
|
|
|
+ ) async throws {
|
|
|
+ try await clock.sleep(until: clock.now.advanced(by: duration), tolerance: tolerance)
|
|
|
}
|
|
|
}
|
|
|
#endif
|