Skip to content

Instantly share code, notes, and snippets.

@mskd12
Created July 26, 2018 03:09
Show Gist options
  • Save mskd12/7095ab3bc058f6089e17a9c0c5baa2e6 to your computer and use it in GitHub Desktop.
Save mskd12/7095ab3bc058f6089e17a9c0c5baa2e6 to your computer and use it in GitHub Desktop.
error in sgxtime, rust-sgx-sdk
diff --git a/samplecode/hello-rust/enclave/src/lib.rs b/samplecode/hello-rust/enclave/src/lib.rs
index ed49b2a..f23800e 100644
--- a/samplecode/hello-rust/enclave/src/lib.rs
+++ b/samplecode/hello-rust/enclave/src/lib.rs
@@ -43,6 +43,9 @@ use std::vec::Vec;
use std::io::{self, Write};
use std::slice;
+use std::time::*;
+use std::untrusted::time::SystemTimeEx;
+
#[no_mangle]
pub extern "C" fn say_something(some_string: *const u8, some_len: usize) -> sgx_status_t {
@@ -63,13 +66,14 @@ pub extern "C" fn say_something(some_string: *const u8, some_len: usize) -> sgx_
for c in word.iter() {
hello_string.push(*c as char);
}
-
+ let start = SystemTime::now();
// Rust style convertion
hello_string += String::from_utf8(word_vec).expect("Invalid UTF-8")
.as_str();
+ let dc_round_duration = SystemTime::now().duration_since(start).expect("Went back in time, lol");
// Ocall to normal world for output
println!("{}", &hello_string);
sgx_status_t::SGX_SUCCESS
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment