mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-29 12:15:39 +00:00
6.6 KiB
6.6 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; retin 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_PARSEwhen the byte after its terminator was zero and succeeded when that byte was uppercaseT. 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_YEARwhen the zone-shifted tick is past 9999 as a signed value, otherwiseINVALID_VALUEwhen 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:
FormatRFC3339returnsINVALID_VALUEwhen adding the zone shift to the tick overflows or underflows 64 bits (earlier SDKs wrap);GetDayOfWeekchecks the month before the year and rejects a year past 9999 (earlier SDKs check the year first, with no upper bound);SetTime_trejects negative seconds withINVALID_VALUEand 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) - measured in a payload process on a PS5 (firmware 13.60), and all 33 cases match: the standard FAT layout with seconds halved; a year before 1980 writes 0 and one after 2107 writes
0xff9fbf7d, both returningINVALID_YEAR; year 0 and an invalid month, day, hour, minute, second or microsecond return their own error without writing; a null argument returnsINVALID_POINTER;SetDosTimedecodes every field unchecked (0xffffffffgives 2107-15-31 31:63:62) and clears the microseconds. What a title process sees is assumed to be the same - 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.
- Local time beyond the host's range (libSceRtc) - when the host cannot convert an instant to local time (on Windows, before 1970 or after 3000), the zone offset is taken from the same instant moved by whole 400-year Gregorian cycles into the host's range, which keeps a POSIX
TZrule's offset; a zone with historical transitions gets its current rule there, not the console's offset, which is not measured outside the probe's -03:00 zone - sceRtcGetCurrentRawNetworkTick (libSceRtc) - the console reads clock 0x13 and returns its time plus the Unix epoch in ticks, or
0x80B50001when 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
0x80B50002and ticks before the Unix epoch return0x80B50003, 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) - measured in a payload process on a PS5 (firmware 13.60): a null tick means the current tick, a precision outside 0 to 6 or a zone outside -1439 to 1439 minutes returns
0x80B50003, the fraction is the microseconds truncated to the requested digits, a local tick before 0001 returns0x80B50003and one after 99990x80B50008, and nothing is written on an error. The local-time variant takes the offset at that tick and checks only the local result, so a tick just past 9999 formats in a zone west of UTC. Firmware 13.42's module, run in an emulator, returns0x80B50008instead before 0001 for titles built below SDK 3.00; not followed here. At most 33 bytes are written; the output buffer size is unknown
Functional
- The process-local clocks set by sceRtcSetCurrentTick, sceRtcSetCurrentNetworkTick, sceRtcSetCurrentAdNetworkTick and sceRtcSetCurrentDebugNetworkTick are visible only through libSceRtc. The system clock and libkernel clock APIs keep reporting host time; cross-library clock consistency is not modelled. The console's clock interactions are not measured