Files
AnyPS5/docs/dev/debt/libSceRtc.md
T
ntamas94andClaude Opus 5.5 2120035611 fix(libSceRtc): keep the pre-3.00 range rules to PS4 titles
The compiled SDK version of a PS5 title counts from its own SDK, so an
early PS5 title would have taken the PS4 pre-3.00 rules. Apply them only
to a CUSA title, as libSceConvertKeycode tells PS4 titles apart; anything
else, including a title without metadata, gets the later rules main had.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-23 18:01:16 +02:00

6.4 KiB

libSceRtc technical debt

Silent stubs

  • sceRtcInit, sceRtcEnd (libSceRtc) - return 0 and do nothing, as the console functions do: both are a bare xor eax, eax; ret in libSceRtc.sprx on firmware 13.60

Unknown function info

  • sceRtcParseDateTime (libSceRtc) - a blank zone after seconds is accepted. With fully allocated input storage on PS5 firmware 13.42 and again on 13.60, the same NUL-terminated text returned BAD_PARSE when the byte after its terminator was zero and succeeded when that byte was uppercase T. This dependence on storage after the terminator is not modeled; controlled backing-byte measurements in a title process are unavailable.
  • sceRtcFormatRFC2822, sceRtcFormatRFC2822LocalTime, sceRtcFormatRFC3339LocalTime (libSceRtc) - measured on PS4 firmware 10.71, not on a PS5: the RFC 2822 text, INVALID_YEAR when the zone-shifted tick is past 9999 as a signed value, otherwise INVALID_VALUE when the source tick or the zone-shifted tick is negative as a signed value, and the local-time variants using the offset in effect at the given instant (+01:00 in January, +02:00 in July on a Central European console). A null tick formatting the current time and the ±1439 minute offset limit come from the PS5 measurement in the next entry and are not measured on the PS4
  • sceRtcFormatRFC3339, sceRtcGetDayOfWeek, sceRtcSetTime_t (libSceRtc) - measured on PS4 firmware 10.71 from processes compiled with SDK versions 0x01000051, 0x02ffffff, 0x03000000 and 0x05050001, not on a PS5. From 0x03000000 on: FormatRFC3339 returns INVALID_VALUE when adding the zone shift to the tick overflows or underflows 64 bits (earlier SDKs wrap); GetDayOfWeek checks the month before the year and rejects a year past 9999 (earlier SDKs check the year first, with no upper bound); SetTime_t rejects negative seconds with INVALID_VALUE and converts all 64 bits (earlier SDKs take the low 32 bits). 0x02ffffff still behaves the earlier way and 0x03000000 the later way. The earlier rules apply only to a PS4 title (a CUSA title ID): a PS5 title has its own SDK numbering, so it always gets the later rules, the behaviour main had before; those are not measured on a PS5.
  • sceRtcGetDosTime, sceRtcSetDosTime (libSceRtc) - bit layout from shadPS4 (PS4, the standard FAT date/time). A year outside 1980-2107 makes GetDosTime return INVALID_YEAR after writing 0 for an earlier one and 0xff9fbf7d (2107-12-31 23:59:58, the largest encodable time) for a later one, and SetDosTime decodes the year as the unsigned 7-bit FAT field (1980-2107) without validating the fields, as the disassembly-derived fpPS4 reimplementation of the PS4 library does; not confirmed on a PS5 title, and shadPS4 instead masks out-of-range years into the packed value and sign-extends the 16-bit date
  • sceRtcFormatRFC2822LocalTime, sceRtcFormatRFC3339LocalTime: the native wrappers obtain the zone from a kernel timezone query, while the host uses the offset at the supplied instant. The kernel timezone configuration and its failure paths are not modeled. Native formatting confirms that null tick pointers select current time, RFC3339 uses two fractional digits, and explicit offsets are limited to -1439 through 1439 minutes.
  • sceRtcGetCurrentRawNetworkTick (libSceRtc) - the console reads clock 0x13 and returns its time plus the Unix epoch in ticks, or 0x80B50001 when the clock is unsupported (errno 5). The raw network clock is not modelled; this returns the host clock. Read from the disassembly of libSceRtc.sprx on firmware 13.60, not measured on a console
  • sceRtcGetCurrentAdNetworkTick, sceRtcGetCurrentDebugNetworkTick (libSceRtc) - the console reads clocks 0x12 and 0x11 and falls back to network clock 0x10 when either clock is unsupported. These getters use their process-local clock when it was set, otherwise they follow the process-local network clock. The firmware's unsupported-clock result is not modelled. Read from the disassembly of libSceRtc.sprx on firmware 13.60, not measured on a console
  • sceRtcSetCurrentTick, sceRtcSetCurrentNetworkTick, sceRtcSetCurrentAdNetworkTick, sceRtcSetCurrentDebugNetworkTick (libSceRtc) - a valid tick sets a process-local clock that advances from a monotonic host clock; the host system clock is not changed. The console sets clock 0, 0x10, 0x12 or 0x11. Null pointers return 0x80B50002 and ticks before the Unix epoch return 0x80B50003, from disassembly of libSceRtc.sprx on firmware 13.60, not measured on a console. sceRtcSetConf passes its third and fourth arguments to the same clock call with clock 0 and throws; what the pair selects is unknown
  • sceRtcFormatRFC3339Precise, sceRtcFormatRFC3339PreciseLocalTime (libSceRtc) - read from the disassembly of libSceRtc.sprx on firmware 13.60: a null tick means the current tick, a precision above 6 or a zone outside -1439 to 1439 minutes returns 0x80B50003, and the fraction is the microseconds truncated to the requested number of digits. Not compared with console output. The output buffer size is unknown; at most 33 bytes are written
  • sceRtcGetYear, sceRtcGetMonth, sceRtcGetDay, sceRtcGetHour, sceRtcGetMinute, sceRtcGetSecond, sceRtcGetMicrosecond, sceRtcSetYear, sceRtcSetMonth, sceRtcSetDay, sceRtcSetHour, sceRtcSetMinute, sceRtcSetSecond, sceRtcSetMicrosecond (libSceRtc) - inferred component behavior without confirmed hardware trace. Component setters validate individual boundaries (e.g. day 1..31) independently without cross-field calendar validation; getters return 0x80B50002 (SCE_RTC_ERROR_INVALID_POINTER) for a null pointer

Functional