File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -252,12 +252,16 @@ public final class ConditionLock<T: Equatable> {
252
252
var curTime = timeval ( )
253
253
gettimeofday ( & curTime, nil )
254
254
255
+ #if canImport(wasi_pthread)
256
+ typealias _Seconds = Int64
257
+ #elseif canImport(Glibc)
258
+ typealias _Seconds = time_t
259
+ #else
260
+ typealias _Seconds = Int
261
+ #endif
262
+
255
263
let allNSecs : Int64 = timeoutNS + Int64( curTime. tv_usec) * 1000
256
- #if canImport(wasi_pthread)
257
- let tvSec = curTime. tv_sec + ( allNSecs / nsecPerSec)
258
- #else
259
- let tvSec = curTime. tv_sec + Int( ( allNSecs / nsecPerSec) )
260
- #endif
264
+ let tvSec = curTime. tv_sec + _Seconds( ( allNSecs / nsecPerSec) )
261
265
262
266
var timeoutAbs = timespec (
263
267
tv_sec: tvSec,
Original file line number Diff line number Diff line change @@ -43,10 +43,18 @@ extension Optional {
43
43
extension timespec {
44
44
@inlinable
45
45
init ( timeAmount amount: TimeAmount ) {
46
+ #if canImport(wasi_pthread)
47
+ typealias _Seconds = Int64
48
+ #elseif canImport(Glibc)
49
+ typealias _Seconds = time_t
50
+ #else
51
+ typealias _Seconds = Int
52
+ #endif
53
+
46
54
let nsecPerSec : Int64 = 1_000_000_000
47
55
let ns = amount. nanoseconds
48
56
let sec = ns / nsecPerSec
49
- self = timespec ( tv_sec: Int ( sec) , tv_nsec: Int ( ns - sec * nsecPerSec) )
57
+ self = timespec ( tv_sec: _Seconds ( sec) , tv_nsec: Int ( ns - sec * nsecPerSec) )
50
58
}
51
59
}
52
60
#endif
You can’t perform that action at this time.
0 commit comments