fix(libSceSystemService): report the host time zone and summer time #5084
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5084"
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 0xRickx on 2026-10-13T11:09:35Z.
What
sceSystemServiceParamGetIntanswered 0 for the time zone (parameter 4) and for summer time (parameter 5), so every title saw a console set to UTC without summer time. libSceRtc and libc convert local time with the host's zone (#4939 is about the same offsets), so a title got two different local times.Titles compute the local time from these two values as UTC + (time zone + 60 × summer time) minutes. Sources for that rule:
Both values now follow the host's local time zone at the moment of the call:
tm_isdstof the host's local time.localtime_s/localtime_r, as libSceRtc's does, soTZis honoured.Prospero Explorer (PPSA99109) shows both on its System information > Console tab (#5071). On a Windows host in Central European Summer Time:
main:Time zone UTC+00:00,Summer time no.UTC+01:00,yes.Not changed here: libkernel's
sceKernelConvertUtcToLocaltime,sceKernelConvertLocaltimeToUtcandsceKernelGettimezonestill use UTC. TheSceKernelTimesecfields need their own references, so they are left for a follow-up. The debt file records this.Tested
Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, on
mainae244d52:New
guest_system_service_time_zonetest (TZset through the CRT, asGuestRtcdoes):IST-5:30gives 330/0,BRT+3gives -180/0,UTC0gives 0/0.CET-1CESTgives a time zone of 60 and a summer time that matches the CRT's owntm_isdstat that moment. glibc and the Windows CRT both apply their default summer time rules to it.CET-1CEST,0/0,J365/25(summer time all year) gives 60/1.It aborts on
mainand passes with the change.guest_system_service,guest_system_service_languageandpatched_librariespass. Full ctest: 1053/1053 passed (8 skipped on this machine).tools/check_conventions.py --base upstream/mainpasses.Prospero Explorer (PPSA99109, catalog 01.000.000), relinked: I reached the Console tab with
APS5_PAD_INPUT_FILE(steps in #5071) and captured it withAPS5_DUMP_FRAMES. The rows changed as shown above.Rebased onto
mainffa2a6ecwithout conflicts (head 84728d60), then tested again onmainc496fd53:guest_system_service,guest_system_service_languageandguest_system_service_time_zonepass. Full ctest: 1088/1088 passed (8 skipped on this machine).guest_system_service,guest_system_service_languageandguest_system_service_time_zonepass, including the all-year summer time zone.guest_math,agc_driver_depth_compare_copyandguest_socket_read_writefail the same way onmainb8683834without any of them in this setup.After the review (CI's Windows runner has a UTC system zone): the summer time shift on Windows is now the C runtime's own bias (
_get_dstbias), as screamm found and tested. Head b36bbe9c onmainff23657f:guest_system_service_time_zone,guest_system_service,guest_system_service_language,guest_system_service_path_boundaryandpatched_librariespass.GetTimeZoneInformationwith a zeroed structure (UTC, no summer time) andTZunset at start: the previous head aborts in theCET-1CESTrow, this head passes. WithTZat start unset,UTC0,CET-1CEST,M3.5.0,M10.5.0/3orEST5EDT, the test passes under both zones.main92e50418together with #5141: the four tests above andpatched_librariespass. Full ctest: 1263/1273; the ten failures (nineagc_*tests andguest_socket_read_write) fail the same way onmain92e50418alone in this setup.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
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T17:39:24Z.
Checked the diff against the references cited (Apollo, GoldHEN, SharpProspero), built and ran the area's ctest on Linux, and confirmed
guest_system_service_time_zonefails without theExport.cppchange and passes with it. Debt line updated and accurate; merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T19:08:24Z.
Review: CHANGES_REQUESTED
The full Build (Windows) fails on this head:
guest_system_service_time_zoneaborts with0xc0000409(run 38609296408,windowsjob, ctest #890). A rerun of the job fails the same way, andmaindoes not have this failure. The log does not say which check aborts.The runner's system time zone is UTC, while this was tested on a CET machine. Could you reproduce it with the system time zone set to UTC and see which
Requirefails? Likely candidates are theCET-1CESTrows (default summer time rules of the CRT versustm_isdst) or the offset calculation inHostTimeZone(). Linux is fine on our side: the test fails without theExport.cppchange and passes with it.Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-15T01:46:46Z.
Windows run of this head alone, merged onto
main6239ceffc(clean merge; it also merges cleanly onto the newer2559e9623, not built). Theguest_system_service_time_zonefailure from the dispatched build reproduces when the system time zone is UTC. The failing check is line 52,Require(ParamInt(SYSTEM_SERVICE_PARAM_ID_TIME_ZONE) == 60);(theCET-1CESTrow), which gets 0.84728d602, base6239ceffc.libspass with 0 errors and no new warnings.--repeat until-fail:3:guest_system_service_time_zone,guest_system_service,guest_system_service_languageandpatched_librarieseach passed 3/3, both withTZunset and withTZ=UTCin the environment.TZ=UTCtherefore does not reproduce the failure.guest_system_service_time_zone_tests.exeunder gdb, withGetTimeZoneInformationanswering what Windows returns for the UTC zone (Bias 0, no DaylightDate). The test aborts with0xc0000409, as on the runner. The last call beforeabort()issceSystemServiceParamGetInt(4) -> 0, the 7th call. The same gdb script without that override runs the test to a normal exit.Cause: libc.prx's static initializer (
tzname_nid_postfix→HostZoneNames()→_tzset()) runs beforemainwhileTZis unset, so the UCRT reads the system time zone. For a zone without summer time it sets_dstbias = 0. When the test later setsTZ(_putenv_s+_tzset), the UCRT updates_timezone,_daylightand the zone names but leaves_dstbiasunchanged. WithCET-1CEST,localtime_sthen reportstm_isdst = 1(the CRT's default rules) but shifts by_dstbias = 0, so local time is UTC+1 andHostTimeZone()returns 60 − 60 = 0. On a CET machine, the system zone has already set_dstbias = -3600, so local time is UTC+2 and the result is 60. That is why the test passed for you.The same
libSceSystemService.prx, called with the test's steps but printing instead of aborting:The
IST-5:30,BRT+3andUTC0rows pass in every mode. With this machine's own time zone, and withTZ=UTC,_dstbiasstays-3600and theCET-1CESTrow gives 60. Subtracting the CRT's own bias on Windows (_get_dstbias, as libc'slocaltime_s_nid_postfixdoes fortm_gmtoff) instead of a fixed 60 would give 60 in both cases. I have not tested that change.ctest -j8 --timeout 120 -E '^agc_driver_|^video_out_flip'): 800/809. These eight timed out while the host was busy and passed when rerun one at a time:conventions_function_bodies,debt_split,hardware_oracle_compare,conventions_bom_shebang,performance_compare,guest_raise_exception,guest_none_relocations,tls_function_coverage_register_address_loads.hardware_oracle_compareneeded a second rerun, then passed 2/2.check_main_syncfails the same way on plainmainhere (console code page).main:Prospero Explorer | FPS: 5.69 (244), still running at 60 s, no stop line.Prospero Explorer | FPS: 11.56 (689), still running at 60 s, no stop line. The frame rate depends on host load.APS5_PAD_INPUT_FILE(down ×7, cross) and captured withAPS5_DUMP_FRAMES:main:Time zone UTC+00:00,Summer time noTime zone UTC+01:00,Summer time yesVerdict: on a CET host the change works in Explorer, and the tests and the non-GPU suite pass. The Windows Build failure reproduces with a UTC system time zone: the failing check is the
CET-1CESTtime-zone row (line 52), because the UCRT keeps the system zone's_dstbiasof 0 afterTZis set. EitherHostTimeZone()or the test needs a change before it can go green on the runner.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-15T06:41:46Z.
Follow-up: the
_get_dstbiaschange suggested above is now tested. Head84728d602merged ontomaind92a8dad3(clean), same host (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, W. Europe system zone with summer time in effect).No new include is needed (
<ctime>declares_get_dstbiason MinGW-w64). The non-Windows branch is unchanged and was not run here.guest_system_service_time_zonewith and without the change, one process per cell. "UTC system zone" is the same gdb override ofGetTimeZoneInformationas in my earlier comment (Bias 0, no DaylightDate); the machine's zone was not changed.TZat process startCET-1CESTrow gets 0, abort0xc0000409)UTC0UTCCET-1CEST,M3.5.0,M10.5.0/3EST5EDTOnly "
TZunset with a system zone that has no summer time" fails before the change: the UCRT reads the system zone once when libc.prx loads and keeps that_dstbias(0) after the test's_putenv_s("TZ", ...)and_tzset(); withTZset at start_dstbiasstays at its initial -3600. After the change,ctest -R '^guest_system_service_time_zone$' --repeat until-fail:3passes 3/3,python tools/check_conventions.py --base mainpasses andgit diff --checkis clean.The Windows job in
.github/workflows/build.ymlruns plainctest --test-dir build --output-on-failure --timeout 120 --parallel 4with noTZ, so the runner's UTC system zone is what the "unset" row simulates. Not covered: a real run on the runner, and a system zone whose summer bias is not 60 minutes.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:07:19Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceSystemService/CMakeLists.txtcore/libs/prx/libSceSystemService/Export.cppdocs/dev/debt/libSceSystemService.mdImported from boykopovar/AnyPS5. Originally posted by 0xRickx on 2026-10-15T14:44:22Z.
Thanks @screamm for finding the cause and testing the change, and @adriadam10 for the review.
I applied screamm's
_get_dstbiaschange and rebased ontomainff23657f(head b36bbe9c). On Windows the summer time shift is now the CRT's own bias, the onelocaltime_sapplied; the non-Windows branch keeps 60 minutes. The debt entry now says how each platform reports a zone whose summer time is not one hour.Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, this machine's zone W. Europe with summer time in effect:
guest_system_service_time_zone,guest_system_service,guest_system_service_language,guest_system_service_path_boundaryandpatched_librariespass.GetTimeZoneInformationwith a zeroed structure (UTC, no summer time) andTZis unset at start. The previous head aborts in theCET-1CESTrow; this head passes.TZat process start unset,UTC0,CET-1CEST,M3.5.0,M10.5.0/3andEST5EDT, the test passes under both the machine's zone and the simulated UTC zone.Not covered: a run on the runner itself. The Linux code path did not change.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-15T21:06:43Z.
Follow-up on head
b36bbe9c6(merged ontomain44df21632, no conflicts). Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, NVIDIA RTX 4070 (driver 596.21). The machine's zone is W. Europe with summer time in effect, and I did not change it.guest_system_service_time_zone,guest_system_service,guest_system_service_language,guest_system_service_path_boundaryandpatched_librariespass 3 of 3.0xc0000409under a UTC system zone): I ran the test under gdb withGetTimeZoneInformationanswering UTC, plus a Lord Howe zone (DaylightBias -30). Each zone was tried withTZat start unset,UTC0,UTC,CET-1CEST,M3.5.0,M10.5.0/3andEST5EDT, 15 runs in all, and every run exits normally. Direct runs on the host zone with sixTZvalues all exit0x0._get_dstbiashunk reverted (the previous head's fixed 60), the UTC zone withTZunset aborts with exception0xc0000409inucrtbase!abortcalled from the test'smain, the same failure as the CI log. The Lord Howe zone withTZunset also aborts. All other cells still pass. Restoring the hunk makes all 15 pass again.APS5_PAD_INPUT_FILE:mainshowsTime zone UTC+00:00/Summer time no; this head showsUTC+01:00/yes. Neither build has a stop line; both were still running at 120 s (659 and 691 frames).check_conventions.py --base origin/mainpasses;git diff --checkis clean.Not checked: the runner itself (its Windows job is still "skipping" on this head), a real
tzutilzone change, Linux, the full build and the non-GPU suite (I built onlylibs, the relinker and these test targets).Written with Claude Code assistance (validation by a subagent, reviewed in this session).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T18:18:29Z.
Review: APPROVED
Re-checked head b36bbe9c: the
_get_dstbiaschange removes the dependency on the system zone for theCET-1CESTrow, matching the reproductions by @screamm and the gdb run in the PR. Built and ran the area's ctest on Linux (47/47), andguest_system_service_time_zonestill fails without theExport.cppchange. Debt entry covers both platforms. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T20:01:44Z.
Rebased onto current
main: the only conflict was thelibSceSystemServicedebt entry (main's language/string lines next to this PR's time-zone line). Kept both, and dropped "time zone, summer time" from the list of values that stay fixed. No code changes. Built and ran the area's ctest on Linux (49/49, includingguest_system_service_time_zone). Merging once the full Build is green.