@@ -47,7 +47,7 @@ mod rustrt {
47
47
}
48
48
}
49
49
50
- #[ cfg( unix, not( target_os = "macos" ) , not( target_os = "ios" ) ) ]
50
+ #[ cfg( all ( unix, not( target_os = "macos" ) , not( target_os = "ios" ) ) ) ]
51
51
mod imp {
52
52
use libc:: { c_int, timespec} ;
53
53
@@ -61,8 +61,7 @@ mod imp {
61
61
}
62
62
63
63
}
64
- #[ cfg( target_os = "macos" ) ]
65
- #[ cfg( target_os = "ios" ) ]
64
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
66
65
mod imp {
67
66
use libc:: { timeval, timezone, c_int, mach_timebase_info} ;
68
67
@@ -150,16 +149,15 @@ pub fn get_time() -> Timespec {
150
149
( ( ns_since_1970 % 1000000 ) * 1000 ) as i32 )
151
150
}
152
151
153
- #[ cfg( target_os = "macos" ) ]
154
- #[ cfg( target_os = "ios" ) ]
152
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
155
153
unsafe fn os_get_time ( ) -> ( i64 , i32 ) {
156
154
use std:: ptr;
157
155
let mut tv = libc:: timeval { tv_sec : 0 , tv_usec : 0 } ;
158
156
imp:: gettimeofday ( & mut tv, ptr:: null_mut ( ) ) ;
159
157
( tv. tv_sec as i64 , tv. tv_usec * 1000 )
160
158
}
161
159
162
- #[ cfg( not( target_os = "macos" ) , not ( target_os = "ios" ) , not ( windows) ) ]
160
+ #[ cfg( not( any ( target_os = "macos" , target_os = "ios" , windows) ) ) ]
163
161
unsafe fn os_get_time ( ) -> ( i64 , i32 ) {
164
162
let mut tv = libc:: timespec { tv_sec : 0 , tv_nsec : 0 } ;
165
163
imp:: clock_gettime ( libc:: CLOCK_REALTIME , & mut tv) ;
@@ -190,8 +188,7 @@ pub fn precise_time_ns() -> u64 {
190
188
return ( ticks as u64 * 1000000000 ) / ( ticks_per_s as u64 ) ;
191
189
}
192
190
193
- #[ cfg( target_os = "macos" ) ]
194
- #[ cfg( target_os = "ios" ) ]
191
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
195
192
fn os_precise_time_ns ( ) -> u64 {
196
193
static mut TIMEBASE : libc:: mach_timebase_info = libc:: mach_timebase_info { numer : 0 ,
197
194
denom : 0 } ;
@@ -205,7 +202,7 @@ pub fn precise_time_ns() -> u64 {
205
202
}
206
203
}
207
204
208
- #[ cfg( not( windows) , not ( target_os = "macos" ) , not ( target_os = "ios" ) ) ]
205
+ #[ cfg( not( any ( windows, target_os = "macos" , target_os = "ios" ) ) ) ]
209
206
fn os_precise_time_ns ( ) -> u64 {
210
207
let mut ts = libc:: timespec { tv_sec : 0 , tv_nsec : 0 } ;
211
208
unsafe {
0 commit comments