feat(libkernel_sys): implement settimeofday #9682
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9682"
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 Gruzzberry on 2026-10-22T08:23:34Z.
What
settimeofdaywas a throwing stub in libkernel_sys. FreeBSD 11.4'skern_settimeofday(called bysys_settimeofday, which treats a null pointer as not given) rejects a time with a negative second count or a microsecond count outside 0 to 999999 withEINVALbefore changing anything, sets the clock from a valid time, and only then stores the time zone, whichsys_gettimeofdayreports.SetTimeOfDay_nid_no_patchinTime.cpp, next toclock_settime, does the same checks. A valid time throws, naming it, asclock_settimedoes forCLOCK_REALTIME, because the host clock is never set; the time zone is then not stored. A time zone given without a time is kept for the process, andgettimeofdaynow reports it instead of 0 and 0 (which it still reports until one is set).settimeofdayin libkernel_sys forwards to the helper.sceKernelGettimezoneis unchanged and still reports 0 and 0: whether the console's reads the same value is not known. The debt entry next toclock_settimerecords the throw, the zone and the unverified privilege check.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmaind6eafa54d0.guest_kernel_sys: newCheckSettimeofdaycases: null time and zone return 0;{0, 1000000},{0, -1}and{-1, 0}fail withEINVALand store nothing; a valid time throws withsettimeofday: setting the time to 1000000000.000000and stores no zone; a zone alone is stored and read back bygettimeofday, which still returns the time; the zone is reset to 0 and 0 at the end. Onmainthe test aborts withsettimeofday_nid_postfix not implemented; with this PR it passes.guest_freebsd_clocks,guest_time_conversion,guest_time_extras,guest_mktime,guest_strftime,guest_utime,guest_utime_forwarding,guest_system_service_time_zone,guest_cpu_time_clocks,guest_nanosleep: pass.maind6eafa54d0and onmainwith this PR merged together with #9442, #9469, #9474, #9487, #9496 and #9661, same machine: 1890 tests each, identical results (1869 passed, 18 skipped; on both, the 3agc_driver_sample_order*tests fail andagc_driver_image_array_window_past_layer_limitis not built, as its 64 KiBalignasis rejected by this MinGW toolchain).python tools/check_conventions.py --base upstream/main: passes.Overlaps
tools/pr_overlap.py --branchlists #9389 (sigqueue), which removes the stub next tosettimeofdayinExport.Discovery.cpp: text only, whichever lands second rebases.libkernel.mdandGuestKernelSys.cpp, are clean. #9103 does not merge withmainitself (libkernel_sys.md, a file this PR does not touch) and merges cleanly here otherwise.gettimeofday,clock_settimeor the time zone.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repositoryExport.Discovery.cpp); this PR then rebases.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T08:47:22Z.
Review: DISMISSED
The implementation and current-main conventions check look consistent with the documented host-clock limitation; I did not independently reproduce the author-reported Windows test run, and this checkout has no build configured for this head. I found one repository-readiness issue before this can proceed: 1. The current open #9389 changes the adjacent
sigqueuestub inExport.Discovery.cpp; a pairwise merge check reports a conflict in that file. The PR body notes that one side will need rebasing, but the contribution rule asks authors to agree on the order and put the dependency on the checklist when one must wait. Please coordinate with #9389 and update the checklist accordingly. This head is also two commits behind currentmain; refresh it and rerun the relevant checks after the #9389 overlap order is resolved. The existing Windows test report and the passing conventions/eligibility checks are noted; product test jobs are skipped automatically on this PR.I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.
Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T11:41:09Z.
Holding this as a draft, following the direction on #5239: the open queue is above 700 and no named title needs this change on current
main. I will only mark it ready again with a current-main title ID, its Game bring-up discussion and the log line where it stops on this, or once the queue is below 700. Thanks for the reviews so far; the requested fixes are being made on the branch in the meantime.