diff options
| author | Tamir Duberstein <tamird@gmail.com> | 2023-09-28 12:27:24 -0400 |
|---|---|---|
| committer | Tamir Duberstein <tamird@gmail.com> | 2023-09-28 17:21:56 -0400 |
| commit | b21eb4f046284040b8e91aff0fd1e7c5125864d1 (patch) | |
| tree | 3003d0ba19c316b8ad2b5b81d92f3b4fd8d42c11 /library/std/src/time.rs | |
| parent | f264d28f2cb941500d89e97a053ae96322c8ed86 (diff) | |
| download | rust-b21eb4f046284040b8e91aff0fd1e7c5125864d1.tar.gz rust-b21eb4f046284040b8e91aff0fd1e7c5125864d1.zip | |
time: use clock_gettime on macos
Replace `gettimeofday` with `clock_gettime(CLOCK_REALTIME)` on:
```
all(target_os = "macos", not(target_arch = "aarch64")),
target_os = "ios",
target_os = "watchos",
target_os = "tvos"
))]
```
`gettimeofday` was first used in
https://github.com/time-rs/time/commit/cc367edd953e72756ed6f0980918795c11e469b1
which predated the introduction of `clock_gettime` support in macOS
10.12 Sierra which became the minimum supported version in
58bbca958d917a89124da248735926f86c59a149.
Diffstat (limited to 'library/std/src/time.rs')
| -rw-r--r-- | library/std/src/time.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/library/std/src/time.rs b/library/std/src/time.rs index c638cc61856..ddac069df76 100644 --- a/library/std/src/time.rs +++ b/library/std/src/time.rs @@ -221,7 +221,7 @@ pub struct Instant(time::Instant); /// |-----------|----------------------------------------------------------------------| /// | SGX | [`insecure_time` usercall]. More information on [timekeeping in SGX] | /// | UNIX | [clock_gettime (Realtime Clock)] | -/// | Darwin | [gettimeofday] | +/// | Darwin | [clock_gettime (Realtime Clock)] | /// | VXWorks | [clock_gettime (Realtime Clock)] | /// | SOLID | `SOLID_RTC_ReadTime` | /// | WASI | [__wasi_clock_time_get (Realtime Clock)] | @@ -230,7 +230,6 @@ pub struct Instant(time::Instant); /// [currently]: crate::io#platform-specific-behavior /// [`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 -/// [gettimeofday]: https://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/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#clock_time_get /// [GetSystemTimePreciseAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime |
