[target.'cfg(any(all(target_arch = "wasm32", not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
dlmalloc = { version = "0.1", features = ['rustc-dep-of-std'] }
+[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
+mach = { version = "0.3.2", default-features = false, features = ['rustc-dep-of-std'] }
+
[target.x86_64-fortanix-unknown-sgx.dependencies]
fortanix-sgx-abi = { version = "0.3.2", features = ['rustc-dep-of-std'] }
#[allow(unused_extern_crates)]
extern crate libc;
+#[cfg(any(target_os = "macos", target_os = "ios"))]
+#[allow(unused_extern_crates)]
+extern crate mach;
+
// We always need an unwinder currently for backtraces
#[doc(masked)]
#[allow(unused_extern_crates)]
impl Instant {
pub fn now() -> Instant {
- Instant { t: unsafe { libc::mach_absolute_time() } }
+ Instant { t: unsafe { mach::mach_time::mach_absolute_time() } }
}
pub const fn zero() -> Instant {
Some(mul_div_u64(nanos, info.denom as u64, info.numer as u64))
}
- fn info() -> libc::mach_timebase_info {
- static mut INFO: libc::mach_timebase_info = libc::mach_timebase_info {
+ fn info() -> mach::mach_time::mach_timebase_info {
+ static mut INFO: mach::mach_time::mach_timebase_info
+ = mach::mach_time::mach_timebase_info {
numer: 0,
denom: 0,
};
// ... otherwise learn for ourselves ...
let mut info = mem::zeroed();
- libc::mach_timebase_info(&mut info);
+ mach::mach_time::mach_timebase_info(&mut info);
// ... and attempt to be the one thread that stores it globally for
// all other threads