pub use fortanix_sgx_abi::*;
use io::{Error as IoError, Result as IoResult};
+use time::Duration;
pub mod alloc;
#[macro_use]
unsafe { raw::send(event_set, tcs).from_sgx_result() }
}
+pub fn insecure_time() -> Duration {
+ let t = unsafe { raw::insecure_time() };
+ Duration::new(t / 1_000_000_000, (t % 1_000_000_000) as _)
+}
+
pub fn alloc(size: usize, alignment: usize) -> IoResult<*mut u8> {
unsafe { raw::alloc(size, alignment).from_sgx_result() }
}
// except according to those terms.
use time::Duration;
-use sys::unsupported_err;
+use super::abi::usercalls;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
pub struct Instant(Duration);
impl Instant {
pub fn now() -> Instant {
- panic!("{}", unsupported_err());
+ Instant(usercalls::insecure_time())
}
pub fn sub_instant(&self, other: &Instant) -> Duration {
impl SystemTime {
pub fn now() -> SystemTime {
- panic!("{}", unsupported_err());
+ SystemTime(usercalls::insecure_time())
}
pub fn sub_time(&self, other: &SystemTime)