Skip to content

fix(libkernel): initialize the full local-time conversion state - #2157

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
authurtabo-byte:fix/kernel-localtime-state
Oct 10, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
authurtabo-byte:fix/kernel-localtime-state

Conversation

@authurtabo-byte

@authurtabo-byte authurtabo-byte commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What

sceKernelConvertLocaltimeToUtc writes an 8-byte KernelTimezone into an output that the PS5 guest libc uses as a 16-byte KernelTimesec. Its west_sec and dst_sec fields 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 KernelTimesec and initialize its timestamp and both offset fields. This keeps the existing UTC-only policy and matches the state returned by sceKernelConvertUtcToLocaltime.

Evidence comes from the title's converted SDK libc: its mktime passes 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_clocks passes (0.45 seconds); conventions pass.

Windows 11, WinLibs GCC, Release. Extended guest_freebsd_clocks with 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

  • Based on current main; no other open PR implements the same fix
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files or images added to the repository
  • No third-party code added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@authurtabo-byte
authurtabo-byte force-pushed the fix/kernel-localtime-state branch from 3bd202e to 035b675 Compare October 9, 2026 22:45
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
@github-actions

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
#2545 sceKernelConvertLocaltimeToUtc

@oneandonlydean
oneandonlydean merged commit 4c39a24 into boykopovar:main Oct 10, 2026
6 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…caltime-state

fix(libkernel): initialize the full local-time conversion state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants