File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,8 @@ extension Test.Clock {
113113 @available ( _clockAPI, * )
114114 static func sleep( for duration: Duration ) async throws {
115115#if SWT_NO_UNSTRUCTURED_TASKS
116- var ts = timespec ( duration)
116+ let timeValue = TimeValue ( duration)
117+ var ts = timespec ( timeValue)
117118 var tsRemaining = ts
118119 while 0 != nanosleep ( & ts, & tsRemaining) {
119120 try Task . checkCancellation ( )
@@ -140,7 +141,7 @@ extension Test.Clock: _Concurrency.Clock {
140141#if SWT_TARGET_OS_APPLE
141142 var res = timespec ( )
142143 _ = clock_getres ( CLOCK_UPTIME_RAW, & res)
143- return Duration ( res)
144+ return Duration ( TimeValue ( res) )
144145#else
145146 SuspendingClock ( ) . minimumResolution
146147#endif
Original file line number Diff line number Diff line change @@ -84,3 +84,9 @@ extension SuspendingClock.Instant {
8484 self = unsafeBitCast ( Duration ( timeValue) , to: SuspendingClock . Instant. self)
8585 }
8686}
87+
88+ extension timespec {
89+ init ( _ timeValue: TimeValue ) {
90+ self . init ( tv_sec: . init( timeValue. seconds) , tv_nsec: . init( timeValue. attoseconds / 1_000_000_000 ) )
91+ }
92+ }
You can’t perform that action at this time.
0 commit comments