From 33788c252c83aeea913482b283e33ccc41bd2860 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 24 Aug 2019 14:49:17 +0200 Subject: [PATCH 1/4] Added table containing the system calls used by Instant and SystemTime. --- src/libstd/time.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 98371b9ba3d7e..f03020bb4954e 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -59,6 +59,21 @@ pub use core::time::Duration; /// println!("{}", now.elapsed().as_secs()); /// } /// ``` +/// +/// # Underlying System calls +/// Currently, the following system calls are being used to get the current time using `now()`: +/// +/// | Platform | System call | +/// |:---------:|:------------------------------------------------:| +/// | Cloud ABI | [clock_time_get (Monotonic Clock)](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt) | +/// | SGX | Not implemented | +/// | UNIX | [mach_absolute_time](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/services/services.html) | +/// | VXWorks | [clock_gettime (Monotonic Clock)](https://linux.die.net/man/3/clock_gettime) | +/// | WASI | [__wasi_clock_time_get (Monotonic Clock)](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get) | +/// | Windows | [QueryPerformanceCounter](https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter) | +/// +/// **Disclaimer:** These system calls might change over time. +/// #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[stable(feature = "time2", since = "1.8.0")] pub struct Instant(time::Instant); @@ -114,6 +129,21 @@ pub struct Instant(time::Instant); /// } /// } /// ``` +/// +/// # Underlying System calls +/// Currently, the following system calls are being used to get the current time using `now()`: +/// +/// | Platform | System call | +/// |:---------:|:------------------------------------------------:| +/// | Cloud ABI | [clock_time_get (Realtime Clock)](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt) | +/// | SGX | Not implemented | +/// | UNIX | [gettimeofday](http://man7.org/linux/man-pages/man2/gettimeofday.2.html) | +/// | VXWorks | [clock_gettime (Realtime Clock)](https://linux.die.net/man/3/clock_gettime) | +/// | WASI | [__wasi_clock_time_get (Realtime Clock)](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get) | +/// | Windows | [GetSystemTimeAsFileTime](https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime) | +/// +/// **Disclaimer:** These system calls might change over time. +/// #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[stable(feature = "time2", since = "1.8.0")] pub struct SystemTime(time::SystemTime); From 1478ef45287c4da0da0daf1715d00e8b06fa333b Mon Sep 17 00:00:00 2001 From: Christian Veenman <46896178+DevQps@users.noreply.github.com> Date: Mon, 26 Aug 2019 22:05:26 +0200 Subject: [PATCH 2/4] Update src/libstd/time.rs Co-Authored-By: lzutao --- src/libstd/time.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libstd/time.rs b/src/libstd/time.rs index f03020bb4954e..c05f02389dfa0 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -70,7 +70,9 @@ pub use core::time::Duration; /// | UNIX | [mach_absolute_time](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/services/services.html) | /// | VXWorks | [clock_gettime (Monotonic Clock)](https://linux.die.net/man/3/clock_gettime) | /// | WASI | [__wasi_clock_time_get (Monotonic Clock)](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get) | -/// | Windows | [QueryPerformanceCounter](https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter) | +/// | Windows | [QueryPerformanceCounter] | + +[QueryPerformanceCounter]: https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter /// /// **Disclaimer:** These system calls might change over time. /// From 3dd0e2b89eec3970467dc10b919923e94a02e258 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 9 Sep 2019 22:10:53 +0200 Subject: [PATCH 3/4] Added some context on SGX. Lists Darwin separately. --- src/libstd/time.rs | 50 +++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/src/libstd/time.rs b/src/libstd/time.rs index c05f02389dfa0..f276ab4200525 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -63,16 +63,23 @@ pub use core::time::Duration; /// # Underlying System calls /// Currently, the following system calls are being used to get the current time using `now()`: /// -/// | Platform | System call | -/// |:---------:|:------------------------------------------------:| -/// | Cloud ABI | [clock_time_get (Monotonic Clock)](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt) | -/// | SGX | Not implemented | -/// | UNIX | [mach_absolute_time](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/services/services.html) | -/// | VXWorks | [clock_gettime (Monotonic Clock)](https://linux.die.net/man/3/clock_gettime) | -/// | WASI | [__wasi_clock_time_get (Monotonic Clock)](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get) | -/// | Windows | [QueryPerformanceCounter] | - -[QueryPerformanceCounter]: https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter +/// | Platform | System call | +/// |:---------:|:--------------------------------------------------------------------:| +/// | Cloud ABI | [clock_time_get (Monotonic Clock)] | +/// | SGX | [`insecure_time` usercall]. More information on [timekeeping in SGX] | +/// | UNIX | [clock_time_get (Monotonic Clock)] | +/// | Darwin | [mach_absolute_time] | +/// | VXWorks | [clock_gettime (Monotonic Clock)] | +/// | WASI | [__wasi_clock_time_get (Monotonic Clock)] | +/// | Windows | [QueryPerformanceCounter] | + +/// [QueryPerformanceCounter]: https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter +/// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time +/// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode +/// [__wasi_clock_time_get (Monotonic Clock)]: https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get +/// [clock_gettime (Monotonic Clock)]: https://linux.die.net/man/3/clock_gettime +/// [mach_absolute_time]: https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/services/services.html +/// [clock_time_get (Monotonic Clock)]: https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt /// /// **Disclaimer:** These system calls might change over time. /// @@ -135,14 +142,21 @@ pub struct Instant(time::Instant); /// # Underlying System calls /// Currently, the following system calls are being used to get the current time using `now()`: /// -/// | Platform | System call | -/// |:---------:|:------------------------------------------------:| -/// | Cloud ABI | [clock_time_get (Realtime Clock)](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt) | -/// | SGX | Not implemented | -/// | UNIX | [gettimeofday](http://man7.org/linux/man-pages/man2/gettimeofday.2.html) | -/// | VXWorks | [clock_gettime (Realtime Clock)](https://linux.die.net/man/3/clock_gettime) | -/// | WASI | [__wasi_clock_time_get (Realtime Clock)](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get) | -/// | Windows | [GetSystemTimeAsFileTime](https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime) | +/// | Platform | System call | +/// |:---------:|:--------------------------------------------------------------------:| +/// | Cloud ABI | [clock_time_get (Realtime Clock)] | +/// | SGX | [`insecure_time` usercall]. More information on [timekeeping in SGX] | +/// | UNIX | [clock_gettime (Realtime Clock)] | +/// | DARWIN | [gettimeofday] | +/// | VXWorks | [clock_gettime (Realtime Clock)] | +/// | WASI | [__wasi_clock_time_get (Realtime Clock)] | +/// | Windows | [GetSystemTimeAsFileTime] | +/// +/// [clock_time_get (Realtime Clock)]: https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt +/// [gettimeofday]: http://man7.org/linux/man-pages/man2/gettimeofday.2.html +/// [clock_gettime (Realtime Clock)]: https://linux.die.net/man/3/clock_gettime +/// [__wasi_clock_time_get (Realtime Clock)]: https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get +/// [GetSystemTimeAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime /// /// **Disclaimer:** These system calls might change over time. /// From b3b671366bc98017fcac7bcfae0d46d038575aa3 Mon Sep 17 00:00:00 2001 From: Christian Veenman <46896178+DevQps@users.noreply.github.com> Date: Fri, 13 Sep 2019 16:29:06 +0200 Subject: [PATCH 4/4] Update src/libstd/time.rs Co-Authored-By: Robin Kruppe --- src/libstd/time.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/time.rs b/src/libstd/time.rs index f276ab4200525..ff209785a935d 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -72,7 +72,7 @@ pub use core::time::Duration; /// | VXWorks | [clock_gettime (Monotonic Clock)] | /// | WASI | [__wasi_clock_time_get (Monotonic Clock)] | /// | Windows | [QueryPerformanceCounter] | - +/// /// [QueryPerformanceCounter]: https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter /// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time /// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode