fix(libkernel): implement clock_gettime for clock id 20 #18466
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18466"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-11-11T17:03:42Z.
What
Implement clock ID 20 for
clock_gettimeandsceKernelClockGettime. Bring-up reports record a startup abort on this clock in Age of Mythology: Retold (PPSA18653) and Star Wars: Galactic Racer (PPSA28416). Age of Mythology report · Galactic Racer reportThe firmware 13.590.001 payload readings advance by 7.8125 ms per half second. Their step values fit 1/32768-second ticks truncated to microseconds. The implementation uses the host monotonic clock as its origin. The console's clock origin and retail-export behavior remain unverified. The older firmware 12.00 raw syscall probe returned EINVAL. Console measurements
Tested
guest_freebsd_clocks,guest_cpu_time_clocks,guest_thread_cpu_clockandpublic_headers. Repository conventions passed.The overlap checker scanned 1,959 open PRs. Review of the flagged diffs found nearby test and debt edits in #17551 and #17958. Those changes may require a rebase depending on merge order.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T17:26:55Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
3007fe3334:tools/check_conventions.pypassed;git diff --checkclean.guest_freebsd_clocks_testsbuilt cleanly.guest_freebsd_clocks):core/libs/prx/libkernel/Time/Time.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T14:26:59Z.
Review: COMMENTED
Reviewed — no blocking findings
I found no blocking defect in the clock 20 code I read at head
3007fe3334e27a49680552cd886f4cfd0701e216. The regression test file was excluded from this review, so its contents are not verified.What I ran
3007fe3334e27a49680552cd886f4cfd0701e216, basemain.description.md,commits.md,manifest.json,diff.patchandfiles.json.searchandcat, about 11 calls).Results
clock_gettimeTime.cpp:644; slow-clock branch runs before the CPU-clock testReader calls (unedited)
Findings
Blocking
None.
Non-blocking
docs/dev/debt/libkernel.md:35(removed line,diff.patchline 35): the entry drops the firmware 11.60 observation for id 20 (a constant 2033.63095 s over three reads, and 79,200 s below uptime). The new entry atdiff.patchline 39 cites only 13.590.001. The 11.60 reading conflicts with the new monotonic-derived origin, so the conflict should stay recorded until it is resolved. Keep the removed evidence, or move it to a line that says it contradicts the current model.docs/dev/debt/libkernel.md:40(diff.patchline 40): the entry saysclock_getresfor id 20 is measured asEINVAL, but the code still throws for it. On the Windows branch this isTime.cpp:723. The same PR could returnGUEST_EINVALfor id 20 inclock_getres, which matches the measurement the entry cites.Sources
Time.cppat head, lines 500–514: the clock 20 branch.Time.cppat head, lines 634–651:clock_gettimedispatch.Time.cppat head, lines 683–723:clock_getresfor unsupported ids.Not verified
core/libs/tests/GuestFreebsdClocks.cppis excluded from this review. The exclusion rule*lock*matches the name because "Clocks" contains "lock", so the rule excludes a regression test by accident. The test changes are not reviewed here.guest_freebsd_clocks,guest_cpu_time_clocks,guest_thread_cpu_clock,public_headers), the WinLibs GCC 15.2 build, and "Repository conventions passed" are author-reported. I did not run them.Time.cppwas read at head only in parts (lines 80–92 and 440–730 of 909). The Linux branch ofclock_getresfor id 20 was not read, so the "throws" claim there is unchecked.docs/dev/debt/libkernel.mdwas read only through its changed hunk, not in full.CPU_CLOCK_BITwas not located inTime.cpp. It does not change the result, because the id 20 branch runs before the CPU-clock test.To get this to a good state
docs/dev/debt/libkernel.md:35).clock_getresfor id 20 should returnEINVAL(docs/dev/debt/libkernel.md:40).