mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-04 19:28:29 +00:00

Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets This is a duplicate of #94100 (since the original author is unresponsive), which resolves #91417. On `aarch64-apple-darwin` targets, the internal resolution of `Instant` is lower than that of `Duration`, so math between them becomes non-associative with small-enough durations. This PR makes this target use the standard Unix implementation (where `Instant` has 1ns resolution), but with `CLOCK_UPTIME_RAW` so it still returns the same values as `mach_absolute_time`[^1]. (Edit: I need someone to confirm that this still works, I do not have access to an M1 device.) [^1]: https://www.manpagez.com/man/3/clock_gettime/