summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorChristian <chris_veenman@hotmail.com>2019-08-24 14:49:17 +0200
committerChristian <chris_veenman@hotmail.com>2019-08-24 14:49:17 +0200
commit33788c252c83aeea913482b283e33ccc41bd2860 (patch)
tree28a15d7c2933736e11f22ce99425850bb112a102 /src/libstd
parent478464570e60523adc6d303577d1782229ca1f93 (diff)
downloadrust-33788c252c83aeea913482b283e33ccc41bd2860.tar.gz
rust-33788c252c83aeea913482b283e33ccc41bd2860.zip
Added table containing the system calls used by Instant and SystemTime.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/time.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libstd/time.rs b/src/libstd/time.rs
index 98371b9ba3d..f03020bb495 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);