Clock: make monotonic_ms monotonic, so a clock jump can't freeze the session
CI / test (push) Failing after 52s

It read the wall clock. When NTP moved a phone from 1970 to now, the frame
loop's elapsed time overflowed and it slept for days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Opus 5.5 committed 2026-11-29 02:22:27 -08:00
1 parent f51ce088ad
commit 4fd2641c80
4 files changed
+30 -3

No files matched your search

+5 -2
View File
@@ -329,9 +329,12 @@ pub fn read_proc_bytes(path : String) -> Bytes {
c_read_proc(str_to_utf8_bytes(path))
}
///| Milliseconds on a monotonic clock.
///|
extern "C" fn c_monotonic_ms() -> UInt64 = "mp_monotonic_ms"
///| Milliseconds on a monotonic clock (CLOCK_MONOTONIC: setting the time doesn't move it).
pub fn monotonic_ms() -> UInt64 {
@env.now()
c_monotonic_ms()
}
///| Print a line to stderr (stdout on native).