]> git.lizzy.rs Git - rust.git/commitdiff
Fix libtime
authorSteven Fackler <sfackler@gmail.com>
Mon, 29 Sep 2014 06:38:43 +0000 (23:38 -0700)
committerSteven Fackler <sfackler@palantir.com>
Tue, 30 Sep 2014 19:52:46 +0000 (12:52 -0700)
src/libtime/lib.rs

index 9cec71104d403f3efe66f7784dabfb37f7e4070f..c1889af0343555f96e5b4c787607c55ee978083d 100644 (file)
@@ -47,7 +47,7 @@ mod rustrt {
     }
 }
 
-#[cfg(unix, not(target_os = "macos"), not(target_os = "ios"))]
+#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))]
 mod imp {
     use libc::{c_int, timespec};
 
@@ -61,8 +61,7 @@ mod imp {
     }
 
 }
-#[cfg(target_os = "macos")]
-#[cfg(target_os = "ios")]
+#[cfg(any(target_os = "macos", target_os = "ios"))]
 mod imp {
     use libc::{timeval, timezone, c_int, mach_timebase_info};
 
@@ -150,8 +149,7 @@ unsafe fn os_get_time() -> (i64, i32) {
          ((ns_since_1970 % 1000000) * 1000) as i32)
     }
 
-    #[cfg(target_os = "macos")]
-    #[cfg(target_os = "ios")]
+    #[cfg(any(target_os = "macos", target_os = "ios"))]
     unsafe fn os_get_time() -> (i64, i32) {
         use std::ptr;
         let mut tv = libc::timeval { tv_sec: 0, tv_usec: 0 };
@@ -159,7 +157,7 @@ unsafe fn os_get_time() -> (i64, i32) {
         (tv.tv_sec as i64, tv.tv_usec * 1000)
     }
 
-    #[cfg(not(target_os = "macos"), not(target_os = "ios"), not(windows))]
+    #[cfg(not(any(target_os = "macos", target_os = "ios", windows)))]
     unsafe fn os_get_time() -> (i64, i32) {
         let mut tv = libc::timespec { tv_sec: 0, tv_nsec: 0 };
         imp::clock_gettime(libc::CLOCK_REALTIME, &mut tv);
@@ -190,8 +188,7 @@ fn os_precise_time_ns() -> u64 {
         return (ticks as u64 * 1000000000) / (ticks_per_s as u64);
     }
 
-    #[cfg(target_os = "macos")]
-    #[cfg(target_os = "ios")]
+    #[cfg(any(target_os = "macos", target_os = "ios"))]
     fn os_precise_time_ns() -> u64 {
         static mut TIMEBASE: libc::mach_timebase_info = libc::mach_timebase_info { numer: 0,
                                                                                    denom: 0 };
@@ -205,7 +202,7 @@ fn os_precise_time_ns() -> u64 {
         }
     }
 
-    #[cfg(not(windows), not(target_os = "macos"), not(target_os = "ios"))]
+    #[cfg(not(any(windows, target_os = "macos", target_os = "ios")))]
     fn os_precise_time_ns() -> u64 {
         let mut ts = libc::timespec { tv_sec: 0, tv_nsec: 0 };
         unsafe {