Skip to content

Commit 33788c2

Browse files
author
Christian
committed
Added table containing the system calls used by Instant and SystemTime.
1 parent 4784645 commit 33788c2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/libstd/time.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,21 @@ pub use core::time::Duration;
5959
/// println!("{}", now.elapsed().as_secs());
6060
/// }
6161
/// ```
62+
///
63+
/// # Underlying System calls
64+
/// Currently, the following system calls are being used to get the current time using `now()`:
65+
///
66+
/// | Platform | System call |
67+
/// |:---------:|:------------------------------------------------:|
68+
/// | Cloud ABI | [clock_time_get (Monotonic Clock)](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt) |
69+
/// | SGX | Not implemented |
70+
/// | UNIX | [mach_absolute_time](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/services/services.html) |
71+
/// | VXWorks | [clock_gettime (Monotonic Clock)](https://linux.die.net/man/3/clock_gettime) |
72+
/// | WASI | [__wasi_clock_time_get (Monotonic Clock)](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get) |
73+
/// | Windows | [QueryPerformanceCounter](https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter) |
74+
///
75+
/// **Disclaimer:** These system calls might change over time.
76+
///
6277
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
6378
#[stable(feature = "time2", since = "1.8.0")]
6479
pub struct Instant(time::Instant);
@@ -114,6 +129,21 @@ pub struct Instant(time::Instant);
114129
/// }
115130
/// }
116131
/// ```
132+
///
133+
/// # Underlying System calls
134+
/// Currently, the following system calls are being used to get the current time using `now()`:
135+
///
136+
/// | Platform | System call |
137+
/// |:---------:|:------------------------------------------------:|
138+
/// | Cloud ABI | [clock_time_get (Realtime Clock)](https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt) |
139+
/// | SGX | Not implemented |
140+
/// | UNIX | [gettimeofday](http://man7.org/linux/man-pages/man2/gettimeofday.2.html) |
141+
/// | VXWorks | [clock_gettime (Realtime Clock)](https://linux.die.net/man/3/clock_gettime) |
142+
/// | WASI | [__wasi_clock_time_get (Realtime Clock)](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get) |
143+
/// | Windows | [GetSystemTimeAsFileTime](https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime) |
144+
///
145+
/// **Disclaimer:** These system calls might change over time.
146+
///
117147
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
118148
#[stable(feature = "time2", since = "1.8.0")]
119149
pub struct SystemTime(time::SystemTime);

0 commit comments

Comments
 (0)