fix(libkernel): initialize the full local-time conversion state #2157
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2157"
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 authurtabo-byte on 2026-10-09T10:14:52Z.
What
sceKernelConvertLocaltimeToUtcwrites an 8-byteKernelTimezoneinto an output that the PS5 guest libc uses as a 16-byteKernelTimesec. Itswest_secanddst_secfields at offsets 8 and 12 remain uninitialized. In MiniGolf, IL2CPP's time-zone initialization repeatedly searches backward through dates and eventually spends a CPU core in calendar conversion, leaving startup black when loading an existing save.Use
KernelTimesecand initialize its timestamp and both offset fields. This keeps the existing UTC-only policy and matches the state returned bysceKernelConvertUtcToLocaltime.Evidence comes from the title's converted SDK libc: its
mktimepasses the fourth argument at stack offset -0x40 and reads its offset fields at -0x38 and -0x34, comparing them with the corresponding state returned by UTC-to-local conversion. An 8-byte write cannot initialize those fields.Tested
Rebased onto main
f8c2f072. Fresh independent Windows Release build:guest_freebsd_clockspasses (0.45 seconds); conventions pass.Windows 11, WinLibs GCC, Release. Extended
guest_freebsd_clockswith poisoned conversion states, surrounding guards, epoch/negative/2026/post-2038 timestamps, round trips and optional null outputs. The test fails with the previous implementation and passes with this change.MiniGolf previously remained on its initial black frame with its SaveData worker continuously running calendar conversion. With this change and the separate startup/rendering fixes in the integration build, the same saved data loads and startup advances to the publisher logo. No save files were removed or modified to bypass the issue.
Conventions and whitespace checks pass. Linux, other titles and hardware comparison were not run.
Checklist
main; no other open PR implements the same fixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T04:20:06Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)sceKernelConvertLocaltimeToUtc