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> {
252252        var  curTime  =  timeval ( ) 
253253        gettimeofday ( & curTime,  nil ) 
254254
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+ 
255263        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) ) 
261265
262266        var  timeoutAbs  =  timespec ( 
263267            tv_sec:  tvSec, 
Original file line number Diff line number Diff line change @@ -43,10 +43,18 @@ extension Optional {
4343extension  timespec  { 
4444    @inlinable  
4545    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+ 
4654        let  nsecPerSec :  Int64  =  1_000_000_000 
4755        let  ns  =  amount. nanoseconds
4856        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) ) 
5058    } 
5159} 
5260#endif 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments