File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -143,8 +143,8 @@ extension ContinuousClock: Clock {
143
143
@_unavailableInEmbedded
144
144
extension ContinuousClock {
145
145
@available ( SwiftStdlib 5 . 7 , * )
146
- @backDeployed ( before : SwiftStdlib 9999 )
147
- public var systemEpoch : Instant { Instant ( _value : . seconds( 0 ) ) }
146
+ @_alwaysEmitIntoClient
147
+ public var systemEpoch : Instant { unsafeBitCast ( Duration . seconds ( 0 ) , to : Instant . self ) }
148
148
}
149
149
150
150
@available ( SwiftStdlib 5 . 7 , * )
Original file line number Diff line number Diff line change @@ -131,8 +131,8 @@ extension SuspendingClock: Clock {
131
131
@_unavailableInEmbedded
132
132
extension SuspendingClock {
133
133
@available ( SwiftStdlib 5 . 7 , * )
134
- @backDeployed ( before : SwiftStdlib 9999 )
135
- public var systemEpoch : Instant { Instant ( _value : . seconds( 0 ) ) }
134
+ @_alwaysEmitIntoClient
135
+ public var systemEpoch : Instant { unsafeBitCast ( Duration . seconds ( 0 ) , to : Instant . self ) }
136
136
}
137
137
138
138
@available ( SwiftStdlib 5 . 7 , * )
Original file line number Diff line number Diff line change @@ -158,6 +158,13 @@ import StdlibUnittest
158
158
}
159
159
}
160
160
161
+ tests. test ( " Ensure abi layout size of Instant " ) {
162
+ // If this test fails it means the ABI of ContinuousClock.Instant has been broken!
163
+ // it MUST be the same laoyut of that of Duration
164
+ expectEqual ( MemoryLayout< ContinuousClock . Instant> . size, MemoryLayout< Duration> . size)
165
+ expectEqual ( MemoryLayout< SuspendingClock . Instant> . size, MemoryLayout< Duration> . size)
166
+ }
167
+
161
168
await runAllTestsAsync ( )
162
169
}
163
170
}
You can’t perform that action at this time.
0 commit comments