diff --git a/Sources/Testing/Events/TimeValue.swift b/Sources/Testing/Events/TimeValue.swift index 5dac1fe08..143aa7091 100644 --- a/Sources/Testing/Events/TimeValue.swift +++ b/Sources/Testing/Events/TimeValue.swift @@ -54,7 +54,11 @@ struct TimeValue: Sendable { @available(_clockAPI, *) init(_ instant: SuspendingClock.Instant) { +#if compiler(>=6.2) + self.init(SuspendingClock().systemEpoch.duration(to: instant)) +#else self.init(unsafeBitCast(instant, to: Duration.self)) +#endif } } @@ -110,7 +114,11 @@ extension Duration { @available(_clockAPI, *) extension SuspendingClock.Instant { init(_ timeValue: TimeValue) { +#if compiler(>=6.2) + self = SuspendingClock().systemEpoch.advanced(by: Duration(timeValue)) +#else self = unsafeBitCast(Duration(timeValue), to: SuspendingClock.Instant.self) +#endif } }