{"action":"created","comment":{"url":"https://api.github.com/repos/akash-fortanix/time/pulls/comments/240618496","pull_request_review_id":183686193,"id":240618496,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDYxODQ5Ng==","diff_hunk":"@@ -270,6 +271,85 @@ mod inner {\n     impl Eq for SteadyTime {}\n }\n \n+#[cfg(target_env = \"sgx\")]\n+mod inner {\n+    use std::ops::{Add, Sub};\n+    use Tm;\n+    use Duration;\n+    use super::common::{time_to_tm, tm_to_time};\n+    use std::time::SystemTime;\n+\n+    #[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq)]\n+    pub struct SteadyTime {\n+        t: Duration\n+    }\n+\n+    pub fn time_to_utc_tm(sec: i64, tm: &mut Tm) {\n+        time_to_tm(sec, tm);\n+    }\n+\n+    pub fn time_to_local_tm(sec: i64, tm: &mut Tm) {\n+        // FIXME: Add timezone logic\n+        time_to_tm(sec, tm);\n+    }\n+\n+    pub fn utc_tm_to_time(tm: &Tm) -> i64 {\n+        tm_to_time(tm)\n+    }\n+\n+    pub fn local_tm_to_time(tm: &Tm) -> i64 {\n+        // FIXME: Add timezone logic\n+        tm_to_time(tm)\n+    }\n+\n+    pub fn get_time() -> (i64, i32) {\n+        match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {\n+            Ok(n) => (n.as_secs() as i64, n.subsec_nanos() as i32),\n+            Err(_) => panic!(\"SystemTime before UNIX EPOCH!\"),\n+        }\n+    }\n+\n+    pub fn get_precise_ns() -> u64 {\n+        match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {\n+            Ok(n) => n.as_nanos() as u64,\n+            Err(_) => panic!(\"SystemTime before UNIX EPOCH!\"),\n+        }\n+    }\n+\n+    impl SteadyTime {\n+        pub fn now() -> SteadyTime {\n+            match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {\n+                Ok(n) => match Duration::from_std(n) {\n+                    Ok(d) => SteadyTime { t: d },\n+                    Err(_) => panic!(\"original duration is larger than the maximum value supported\"),\n+                },\n+                Err(_) => panic!(\"SystemTime before UNIX EPOCH!\"),\n+            }\n+        }\n+    }\n+\n+    impl Sub for SteadyTime {\n+        type Output = Duration;\n+        fn sub(self, _other: SteadyTime) -> Duration {","path":"src/sys.rs","position":71,"original_position":71,"commit_id":"5d88b69533f290e1979f0375d4637e94001f89fe","original_commit_id":"5d88b69533f290e1979f0375d4637e94001f89fe","user":{"login":"jethrogb","id":1132307,"node_id":"MDQ6VXNlcjExMzIzMDc=","avatar_url":"https://avatars0.githubusercontent.com/u/1132307?v=4","gravatar_id":"","url":"https://api.github.com/users/jethrogb","html_url":"https://github.com/jethrogb","followers_url":"https://api.github.com/users/jethrogb/followers","following_url":"https://api.github.com/users/jethrogb/following{/other_user}","gists_url":"https://api.github.com/users/jethrogb/gists{/gist_id}","starred_url":"https://api.github.com/users/jethrogb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jethrogb/subscriptions","organizations_url":"https://api.github.com/users/jethrogb/orgs","repos_url":"https://api.github.com/users/jethrogb/repos","events_url":"https://api.github.com/users/jethrogb/events{/privacy}","received_events_url":"https://api.github.com/users/jethrogb/received_events","type":"User","site_admin":false},"body":"Remove `_` prefix","created_at":"2018-12-11T13:55:41Z","updated_at":"2018-12-11T13:55:47Z","html_url":"https://github.com/akash-fortanix/time/pull/1#discussion_r240618496","pull_request_url":"https://api.github.com/repos/akash-fortanix/time/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/akash-fortanix/time/pulls/comments/240618496"},"html":{"href":"https://github.com/akash-fortanix/time/pull/1#discussion_r240618496"},"pull_request":{"href":"https://api.github.com/repos/akash-fortanix/time/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/akash-fortanix/time/pulls/1","id":237685400,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3Njg1NDAw","html_url":"https://github.com/akash-fortanix/time/pull/1","diff_url":"https://github.com/akash-fortanix/time/pull/1.diff","patch_url":"https://github.com/akash-fortanix/time/pull/1.patch","issue_url":"https://api.github.com/repos/akash-fortanix/time/issues/1","number":1,"state":"open","locked":false,"title":"Add support for x86_64-fortanix-unknown-sgx target","user":{"login":"akash-fortanix","id":44128026,"node_id":"MDQ6VXNlcjQ0MTI4MDI2","avatar_url":"https://avatars3.githubusercontent.com/u/44128026?v=4","gravatar_id":"","url":"https://api.github.com/users/akash-fortanix","html_url":"https://github.com/akash-fortanix","followers_url":"https://api.github.com/users/akash-fortanix/followers","following_url":"https://api.github.com/users/akash-fortanix/following{/other_user}","gists_url":"https://api.github.com/users/akash-fortanix/gists{/gist_id}","starred_url":"https://api.github.com/users/akash-fortanix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akash-fortanix/subscriptions","organizations_url":"https://api.github.com/users/akash-fortanix/orgs","repos_url":"https://api.github.com/users/akash-fortanix/repos","events_url":"https://api.github.com/users/akash-fortanix/events{/privacy}","received_events_url":"https://api.github.com/users/akash-fortanix/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-11T13:47:49Z","updated_at":"2018-12-11T13:55:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b68a28089a157c3ea300615b4063697be3b9ec6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/akash-fortanix/time/pulls/1/commits","review_comments_url":"https://api.github.com/repos/akash-fortanix/time/pulls/1/comments","review_comment_url":"https://api.github.com/repos/akash-fortanix/time/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akash-fortanix/time/issues/1/comments","statuses_url":"https://api.github.com/repos/akash-fortanix/time/statuses/5d88b69533f290e1979f0375d4637e94001f89fe","head":{"label":"akash-fortanix:sgx-target","ref":"sgx-target","sha":"5d88b69533f290e1979f0375d4637e94001f89fe","user":{"login":"akash-fortanix","id":44128026,"node_id":"MDQ6VXNlcjQ0MTI4MDI2","avatar_url":"https://avatars3.githubusercontent.com/u/44128026?v=4","gravatar_id":"","url":"https://api.github.com/users/akash-fortanix","html_url":"https://github.com/akash-fortanix","followers_url":"https://api.github.com/users/akash-fortanix/followers","following_url":"https://api.github.com/users/akash-fortanix/following{/other_user}","gists_url":"https://api.github.com/users/akash-fortanix/gists{/gist_id}","starred_url":"https://api.github.com/users/akash-fortanix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akash-fortanix/subscriptions","organizations_url":"https://api.github.com/users/akash-fortanix/orgs","repos_url":"https://api.github.com/users/akash-fortanix/repos","events_url":"https://api.github.com/users/akash-fortanix/events{/privacy}","received_events_url":"https://api.github.com/users/akash-fortanix/received_events","type":"User","site_admin":false},"repo":{"id":161305358,"node_id":"MDEwOlJlcG9zaXRvcnkxNjEzMDUzNTg=","name":"time","full_name":"akash-fortanix/time","private":false,"owner":{"login":"akash-fortanix","id":44128026,"node_id":"MDQ6VXNlcjQ0MTI4MDI2","avatar_url":"https://avatars3.githubusercontent.com/u/44128026?v=4","gravatar_id":"","url":"https://api.github.com/users/akash-fortanix","html_url":"https://github.com/akash-fortanix","followers_url":"https://api.github.com/users/akash-fortanix/followers","following_url":"https://api.github.com/users/akash-fortanix/following{/other_user}","gists_url":"https://api.github.com/users/akash-fortanix/gists{/gist_id}","starred_url":"https://api.github.com/users/akash-fortanix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akash-fortanix/subscriptions","organizations_url":"https://api.github.com/users/akash-fortanix/orgs","repos_url":"https://api.github.com/users/akash-fortanix/repos","events_url":"https://api.github.com/users/akash-fortanix/events{/privacy}","received_events_url":"https://api.github.com/users/akash-fortanix/received_events","type":"User","site_admin":false},"html_url":"https://github.com/akash-fortanix/time","description":"Simple time handling in Rust","fork":true,"url":"https://api.github.com/repos/akash-fortanix/time","forks_url":"https://api.github.com/repos/akash-fortanix/time/forks","keys_url":"https://api.github.com/repos/akash-fortanix/time/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akash-fortanix/time/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akash-fortanix/time/teams","hooks_url":"https://api.github.com/repos/akash-fortanix/time/hooks","issue_events_url":"https://api.github.com/repos/akash-fortanix/time/issues/events{/number}","events_url":"https://api.github.com/repos/akash-fortanix/time/events","assignees_url":"https://api.github.com/repos/akash-fortanix/time/assignees{/user}","branches_url":"https://api.github.com/repos/akash-fortanix/time/branches{/branch}","tags_url":"https://api.github.com/repos/akash-fortanix/time/tags","blobs_url":"https://api.github.com/repos/akash-fortanix/time/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akash-fortanix/time/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akash-fortanix/time/git/refs{/sha}","trees_url":"https://api.github.com/repos/akash-fortanix/time/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akash-fortanix/time/statuses/{sha}","languages_url":"https://api.github.com/repos/akash-fortanix/time/languages","stargazers_url":"https://api.github.com/repos/akash-fortanix/time/stargazers","contributors_url":"https://api.github.com/repos/akash-fortanix/time/contributors","subscribers_url":"https://api.github.com/repos/akash-fortanix/time/subscribers","subscription_url":"https://api.github.com/repos/akash-fortanix/time/subscription","commits_url":"https://api.github.com/repos/akash-fortanix/time/commits{/sha}","git_commits_url":"https://api.github.com/repos/akash-fortanix/time/git/commits{/sha}","comments_url":"https://api.github.com/repos/akash-fortanix/time/comments{/number}","issue_comment_url":"https://api.github.com/repos/akash-fortanix/time/issues/comments{/number}","contents_url":"https://api.github.com/repos/akash-fortanix/time/contents/{+path}","compare_url":"https://api.github.com/repos/akash-fortanix/time/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akash-fortanix/time/merges","archive_url":"https://api.github.com/repos/akash-fortanix/time/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akash-fortanix/time/downloads","issues_url":"https://api.github.com/repos/akash-fortanix/time/issues{/number}","pulls_url":"https://api.github.com/repos/akash-fortanix/time/pulls{/number}","milestones_url":"https://api.github.com/repos/akash-fortanix/time/milestones{/number}","notifications_url":"https://api.github.com/repos/akash-fortanix/time/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akash-fortanix/time/labels{/name}","releases_url":"https://api.github.com/repos/akash-fortanix/time/releases{/id}","deployments_url":"https://api.github.com/repos/akash-fortanix/time/deployments","created_at":"2018-12-11T08:55:05Z","updated_at":"2018-12-11T08:55:08Z","pushed_at":"2018-12-11T13:47:49Z","git_url":"git://github.com/akash-fortanix/time.git","ssh_url":"git@github.com:akash-fortanix/time.git","clone_url":"https://github.com/akash-fortanix/time.git","svn_url":"https://github.com/akash-fortanix/time","homepage":null,"size":969,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"akash-fortanix:master","ref":"master","sha":"e313afbd9aad2ba7035a23754b5d47105988789d","user":{"login":"akash-fortanix","id":44128026,"node_id":"MDQ6VXNlcjQ0MTI4MDI2","avatar_url":"https://avatars3.githubusercontent.com/u/44128026?v=4","gravatar_id":"","url":"https://api.github.com/users/akash-fortanix","html_url":"https://github.com/akash-fortanix","followers_url":"https://api.github.com/users/akash-fortanix/followers","following_url":"https://api.github.com/users/akash-fortanix/following{/other_user}","gists_url":"https://api.github.com/users/akash-fortanix/gists{/gist_id}","starred_url":"https://api.github.com/users/akash-fortanix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akash-fortanix/subscriptions","organizations_url":"https://api.github.com/users/akash-fortanix/orgs","repos_url":"https://api.github.com/users/akash-fortanix/repos","events_url":"https://api.github.com/users/akash-fortanix/events{/privacy}","received_events_url":"https://api.github.com/users/akash-fortanix/received_events","type":"User","site_admin":false},"repo":{"id":161305358,"node_id":"MDEwOlJlcG9zaXRvcnkxNjEzMDUzNTg=","name":"time","full_name":"akash-fortanix/time","private":false,"owner":{"login":"akash-fortanix","id":44128026,"node_id":"MDQ6VXNlcjQ0MTI4MDI2","avatar_url":"https://avatars3.githubusercontent.com/u/44128026?v=4","gravatar_id":"","url":"https://api.github.com/users/akash-fortanix","html_url":"https://github.com/akash-fortanix","followers_url":"https://api.github.com/users/akash-fortanix/followers","following_url":"https://api.github.com/users/akash-fortanix/following{/other_user}","gists_url":"https://api.github.com/users/akash-fortanix/gists{/gist_id}","starred_url":"https://api.github.com/users/akash-fortanix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akash-fortanix/subscriptions","organizations_url":"https://api.github.com/users/akash-fortanix/orgs","repos_url":"https://api.github.com/users/akash-fortanix/repos","events_url":"https://api.github.com/users/akash-fortanix/events{/privacy}","received_events_url":"https://api.github.com/users/akash-fortanix/received_events","type":"User","site_admin":false},"html_url":"https://github.com/akash-fortanix/time","description":"Simple time handling in Rust","fork":true,"url":"https://api.github.com/repos/akash-fortanix/time","forks_url":"https://api.github.com/repos/akash-fortanix/time/forks","keys_url":"https://api.github.com/repos/akash-fortanix/time/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akash-fortanix/time/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akash-fortanix/time/teams","hooks_url":"https://api.github.com/repos/akash-fortanix/time/hooks","issue_events_url":"https://api.github.com/repos/akash-fortanix/time/issues/events{/number}","events_url":"https://api.github.com/repos/akash-fortanix/time/events","assignees_url":"https://api.github.com/repos/akash-fortanix/time/assignees{/user}","branches_url":"https://api.github.com/repos/akash-fortanix/time/branches{/branch}","tags_url":"https://api.github.com/repos/akash-fortanix/time/tags","blobs_url":"https://api.github.com/repos/akash-fortanix/time/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akash-fortanix/time/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akash-fortanix/time/git/refs{/sha}","trees_url":"https://api.github.com/repos/akash-fortanix/time/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akash-fortanix/time/statuses/{sha}","languages_url":"https://api.github.com/repos/akash-fortanix/time/languages","stargazers_url":"https://api.github.com/repos/akash-fortanix/time/stargazers","contributors_url":"https://api.github.com/repos/akash-fortanix/time/contributors","subscribers_url":"https://api.github.com/repos/akash-fortanix/time/subscribers","subscription_url":"https://api.github.com/repos/akash-fortanix/time/subscription","commits_url":"https://api.github.com/repos/akash-fortanix/time/commits{/sha}","git_commits_url":"https://api.github.com/repos/akash-fortanix/time/git/commits{/sha}","comments_url":"https://api.github.com/repos/akash-fortanix/time/comments{/number}","issue_comment_url":"https://api.github.com/repos/akash-fortanix/time/issues/comments{/number}","contents_url":"https://api.github.com/repos/akash-fortanix/time/contents/{+path}","compare_url":"https://api.github.com/repos/akash-fortanix/time/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akash-fortanix/time/merges","archive_url":"https://api.github.com/repos/akash-fortanix/time/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akash-fortanix/time/downloads","issues_url":"https://api.github.com/repos/akash-fortanix/time/issues{/number}","pulls_url":"https://api.github.com/repos/akash-fortanix/time/pulls{/number}","milestones_url":"https://api.github.com/repos/akash-fortanix/time/milestones{/number}","notifications_url":"https://api.github.com/repos/akash-fortanix/time/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akash-fortanix/time/labels{/name}","releases_url":"https://api.github.com/repos/akash-fortanix/time/releases{/id}","deployments_url":"https://api.github.com/repos/akash-fortanix/time/deployments","created_at":"2018-12-11T08:55:05Z","updated_at":"2018-12-11T08:55:08Z","pushed_at":"2018-12-11T13:47:49Z","git_url":"git://github.com/akash-fortanix/time.git","ssh_url":"git@github.com:akash-fortanix/time.git","clone_url":"https://github.com/akash-fortanix/time.git","svn_url":"https://github.com/akash-fortanix/time","homepage":null,"size":969,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akash-fortanix/time/pulls/1"},"html":{"href":"https://github.com/akash-fortanix/time/pull/1"},"issue":{"href":"https://api.github.com/repos/akash-fortanix/time/issues/1"},"comments":{"href":"https://api.github.com/repos/akash-fortanix/time/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/akash-fortanix/time/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/akash-fortanix/time/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akash-fortanix/time/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/akash-fortanix/time/statuses/5d88b69533f290e1979f0375d4637e94001f89fe"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jethrogb"}}