feat(libc): implement C11 timespec_get for PPSA34015 #9388
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9388"
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 xXPBSXx on 2026-10-21T20:11:56Z.
What
Carries #6084 (@notaxeltv) onto current
main, as @oneandonlydean announced there on 20.10. (24 h without a reply from the author, keeping both commits and crediting both). #6084's commit implements C11timespec_getforTIME_UTC(importyrx+40YKqiIof PPSA34015, listed bytools/import_audit.py) with the realtime source of_Xtime_get_ticks, returning 0 for a null pointer or an unsupported base. The second commit resolves the review point on #6084: it writes the guest's 16-bytetimespec(two 64-bit fields,KernelTimespec), not the hosttimespec, whosetv_nsecis 32 bits on MinGW, and the test pre-fills a guest struct with a non-zero pattern so a 32-bit write fails. Based on the heads of #6084 andxXPBSXx:fix/timespec-get-guest-layout.Tested
Windows 10 19045, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmainea241c01b3with both commits merged (the rebased head only differs by its newer base):ctest -R '^guest_timespec_get$'passes 3 of 3;guest_time_conversionandguest_mktimepass (3 of 3 together).libc/src/Time.cpprestored tomainthe test does not link (undefined reference to timespec_get_nid_postfix). On #6084's head alone the layout case fails 3 of 3 (0xc0000409), as @xXPBSXx posted there on 20.10.python tools/check_conventions.py --base upstream/mainpasses;git merge-treeagainstmainis clean.APS5_PLAYGO_UNLISTED_CHUNKS=absent,main1a745ae38eplus #9439 (to record calls) plus this PR's headd9d01fa01, merged. The title reachestimespec_getand keeps running:libc.prx yrx+40YKqiIis called 19,588 times in a 2-minute run that ends only because it was stopped (no crash, noNotImplemented). That reporter did not runmainwithout this PR past an unrelated keyboard abort, so what the missing import does there is not shown; and the run needed a local-only revert ofsceConvertKeycodeGetImeKeyboardType(not part of this PR), because currentmainaborts that title 1.8 s in.Checklist
main; no other open PR implements the same functions (#6084 is the one this carries; it can be closed as superseded once this merges).mdfiles or images added to the repositorytimespec_get)AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T20:12:47Z.
Progress report (
0c6a5bd→d9d01fa)📈 System libraries: 42.11% (+0.01%, +1 implemented functions)
✅ 1 implemented
timespec_get_nid_postfixImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T22:44:01Z.
Code review location:
core/libs/tests/GuestTimespecGet.cpp; line 26This second-read ordering check assumes UTC wall-clock time is monotonic. Both
clock_gettime(CLOCK_REALTIME)andGetSystemTimePreciseAsFileTimecan move backward after an administrator/NTP clock correction, so the test can fail even whentimespec_getcorrectly returns UTC. Please avoid comparing two wall-clock reads, or bound the result against an independently sampled wall clock with an allowance that does not require monotonicity.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T22:44:08Z.
Review: APPROVED
Reviewed both retained commits and the guest-layout fix. The
KernelTimespecfields are written explicitly, and the test now pre-fills the 16-byte guest layout so the MinGW-width regression is observable. The commits retain their original contributor authorship, and the PR describes the superseding relationship to #6084. Hosted eligibility, intake, conventions, relinker and test-support checks are green. I left a non-blocking inline note about the test comparing two UTC wall-clock reads, which can move backward after clock correction.Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-21T23:40:21Z.
Linux run of the current head (the Linux run on #6084 predates the
KernelTimespeccommit).Head
d9d01fa018merged onto maina6dcea927(clean). WSL2 Ubuntu 24.04, GCC 13.3.0, Release.guest_timespec_get,guest_time_conversion,guest_mktime: 3/3, 3 runs.libc/src/Time.cppfrom main the test does not link (timespec_get_nid_postfix), as on Windows.yrx+40YKqiIistimespec_getby the repo's NID algorithm.AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T06:17:59Z.
I rechecked this head against current
main(d6732b51a64f4322799af89b876b224d3aed6efc). The focused Linux target built successfully andguest_timespec_getpassed 3/3 locally;check_conventions.py --base upstream/mainandgit diff --checkalso pass. The independent Windows and WSL2 reports in the PR provide complementary runtime coverage.One coordination item surfaced since the prior review: open #9447 also changes
core/libs/prx/libc/src/Time.cpp, and a merge-tree of the two PR heads reports a content conflict in that file. Please coordinate merge order with its author and make sure both changes are retained (for example, rebase the later PR after the first lands). #6084 remains the intentional superseded source of the first commit and should continue to be credited as already described. The current main merge-tree for this PR alone is clean, but its base is 481 commits behind; please refresh it before merge.Pull request closed