libkernel/libc: the time zone is UTC in sceKernelConvertUtcToLocaltime but the host's in localtime #5067
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 nicolasfalesy on 2026-10-13T10:23:16Z.
A question about intended behaviour, not a crash.
libkernel/Time/Time.cppkeeps the console clock in UTC on purpose (the comment abovesceKernelClockGetres: "the time zone reported here and by gettimeofday has no offset and no daylight saving"). SosceKernelConvertUtcToLocaltimeandsceKernelConvertLocaltimeToUtcreturn the time unchanged, andsceKernelGettimezonereports zero.libc/src/Time.cppdoes the opposite:localtime/localtime_suse the host's zone (TZdefaults to:/etc/localtime, thentzset).So one title can get two different local times. On Linux (
main7e181fcc3, host zone America/Toronto, UTC−4), PS5SX2 (PPSA99203, with #4776) imports bothlocaltimeandsceKernelConvertUtcToLocaltime, and its frontend clock showed 06:04 at 02:04 local time. Titles that use only libclocaltimeshow the host's time.Which is intended: should the kernel conversions follow the host zone like libc does, or should libc report UTC to match the kernel? I haven't checked which of the two PS5SX2 uses for that clock.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T12:42:37Z.
The discrepancy is accounted for by the title path: PS5SX2 derives its visible clock from
sceKernelConvertUtcToLocaltime, while libclocaltimeuses the host time zone. Open PR #5096 addresses this by making both kernel conversion functions use the host zone, matching libc. It leavessceKernelGettimezoneunchanged because that call’s console behavior has not been established; #5084 separately handles SystemService’s time-zone and summer-time parameters. These changes are still under review.