Repository navigation
fix(libkernel): convert local time with the host time zone - #1
Merged
Merged
Conversation
sceKernelConvertUtcToLocaltime and sceKernelConvertLocaltimeToUtc returned the time unchanged while libc localtime follows the host zone, so a title that mixes them shows UTC as local time (boykopovar#5067). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017iLxaSz4qjmirfqKZdhVQk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes boykopovar#5067.
sceKernelConvertUtcToLocaltimeandsceKernelConvertLocaltimeToUtcreturned the time unchanged, while libclocaltimefollows the host zone. PPSA99203 (PS5SX2) draws its on-screen clock and its settings log times fromsceKernelConvertUtcToLocaltimefollowed bygmtime_r(source). Because of that, it showed UTC as local time in boykopovar#5067.localtime_r/tm_gmtoffon POSIX andlocaltime_swith_get_timezone/_get_dstbiason Windows, the same sources libclocaltime_suses. Windows times outside the CRT range move by whole 400-year cycles, as libc does.KernelTimesec.west_secholds the standard offset in seconds east of UTC, despite its name, anddst_secholds the daylight saving seconds in effect. This follows PS5SX2's own notes from a console, where the call wrote 7200 and 3600, and shadPS4, which also stores seconds east. Whetherwest_secincludes daylight saving is not settled, and the open question is recorded indocs/dev/debt/libkernel.md.sceKernelConvertLocaltimeToUtcfinds the offset in two passes. In a skipped or repeated local hour it takes the offset in effect one standard offset earlier (recorded as debt).sceKernelGettimezoneand thegettimeofdaytime zone are unchanged (no offset, no daylight saving) and recorded as debt. fix(libSceSystemService): report the host time zone and summer time boykopovar/AnyPS5#5084 makes the matching change forsceSystemServiceParamGetInt.Tested
Ubuntu 24.04, GCC 13.3, Release.
guest_freebsd_clockspasses. It now pinsTZand checks both directions forUTC0,IST-5:30(+5:30),BRT+3(-3:00) andEST5EDTin January (-5:00) and July (-4:00 with 3600 s of daylight saving), including theKernelTimesecfields. It also passes with no zoneinfo files (TZDIR=/nonexistent) and with a hostTZ=America/Toronto. The new checks abort on the previousTime.cpp. The existing identity and guard checks run underUTC0. Relinker-only build: all tests pass. Not tested on Windows or with a title.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)🤖 Generated with Claude Code
https://claude.ai/code/session_017iLxaSz4qjmirfqKZdhVQk