Instant::now()
on Android (and other Linux platforms) is currently implemented using libc::clock_gettime(CLOCK_MONOTONIC)
. Apparently this clock does not advance while the CPU is in deep sleep modes. This is also how Android's SystemClock.uptimeMillis
method works.
Android also offers a SystemClock.elapsedRealTime
method, which seems to be implemented using an Android-specific ioctl. Perhaps it would be possible to migrate the Rust standard library to use this call on Android, if there are no trade-offs in precision.