Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 88eafa4

Browse files
author
Anirudh Mathukumilli
committed
Use CLOCK_BOOTTIME for Instant in Fuchsia/Android
Fuchsia and Android both want Instants to progress during periods of suspension, and thus must use CLOCK_BOOTTIME as the backing reference clock.
1 parent e473783 commit 88eafa4

File tree

1 file changed

+5
-1
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+5
-1
lines changed

‎library/std/src/sys/pal/unix/time.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ impl Instant {
271271
// we preserve this value domain out of an abundance of caution.
272272
#[cfg(target_vendor = "apple")]
273273
const clock_id: libc::clockid_t = libc::CLOCK_UPTIME_RAW;
274-
#[cfg(not(target_vendor = "apple"))]
274+
// Instant is intended to progress forward during periods of suspension
275+
// in both Android and Fuchsia, and therefore uses CLOCK_BOOTTIME.
276+
#[cfg(any(target_os = "android", target_os = "fuchsia"))]
277+
const clock_id: libc::clockid_t = libc::CLOCK_BOOTTIME;
278+
#[cfg(not(any(target_vendor = "apple", target_os = "fuchsia", target_os = "android")))]
275279
const clock_id: libc::clockid_t = libc::CLOCK_MONOTONIC;
276280
Instant { t: Timespec::now(clock_id) }
277281
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /