The local-time round trip converted the current tick. During the hour
that repeats when daylight saving time ends, that local time occurs
twice, so converting it back can give the other instant and the check
fails. Convert the test's fixed leap-day tick instead.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
EnterTitleDirectory named the run's directory after the current
steady_clock value. guest_rtc and guest_rtc_ps5_title run the same test
binary, and when ctest starts both at once they can read the same value
and share one directory; guest_rtc then writes its PS4 title there and
the PS5 run reads it and aborts. Name the directory with
std::random_device instead, as the other tests that make temporary
directories do.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
Measured on PS4 firmware 10.71 from processes compiled with SDK versions
0x01000051, 0x02ffffff, 0x03000000 and 0x05050001. From 0x03000000 on,
FormatRFC3339 returns INVALID_VALUE when the zone shift overflows or
underflows the tick, GetDayOfWeek checks the month before the year and
rejects years past 9999, and SetTime_t rejects negative seconds and
converts all 64 bits. 0x02ffffff and earlier keep the wrap, the year-first
order and the low 32 bits.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Measured on a PS4 (firmware 10.71) for the review of the zone-shift
overflow: sceRtcFormatRFC2822 returns 0x80B50003 for UINT64_MAX with +1
and +1439 minutes and for 2^64 - 1 minute with +1, where the shifted tick
lands in year 1. The console returns 0x80B50008 when the shifted tick is
past 9999 as a signed value (2^63 with -1 minute) and otherwise 0x80B50003
when the source or the shifted tick is negative as a signed value
(2^63 with 0, 0 with -1); the tick after 9999 with -1 minute still formats.
sceRtcFormatRFC3339 does wrap on the console: UINT64_MAX with +1 minute
returns 0 and writes 0001-01-01T00:00:59.99+00:01, as the implementation
already does. Tests now cover both.
Written with AI assistance.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Measured on a PS4 (firmware 10.71) with an OpenOrbis homebrew that loads a
probe PRX calling libSceRtc; every output starts as a sentinel, so stores
and their width are visible.
- sceRtcSetTime_t takes the low 32 bits of its argument as unsigned seconds
and returns 0 for every value: -1 is 2106-02-07 06:28:15, 2^32 + 1 is
1970-01-01 00:00:01 and -2^31 is 2038-01-19 03:14:08. sceRtcGetTime_t
stays 64-bit (2106-02-07 06:28:16 is 2^32).
- sceRtcGetTime_t before 1970 and sceRtcGetWin32FileTime before 1601 store
0 and return 0x80B50008. Field validation still comes first and leaves
the output unchanged (1969-13-01 returns 0x80B50009).
- sceRtcSetTick and sceRtcSetWin32FileTime have no upper limit: the tick
after 9999-12-31 23:59:59.999999 is 10000-01-01 and the file time
2^64 - 1 is 60056-05-28 05:36:10.955161. sceRtcGetDayOfWeek accepts
years past 9999 (10000-01-01 is 6).
- sceRtcFormatRFC3339 returns 0x80B50008 when the zone-shifted tick is
outside years 1 to 9999. sceRtcFormatRFC2822 returns 0x80B50003 when it
is negative as a signed value and 0x80B50008 when it is past 9999.
The PS5-measured cases of GuestRtc.cpp that the probe repeated (RFC 3339
and RFC 2822 parsing, named and military zones, DOS time, TickAdd) give the
same results on the PS4. The three expectations changed here (SetTick past
9999, SetTime_t(-1), RFC 2822 at the limit with +1 minute) came from
commits that cite no measurement. Not yet confirmed on PS5.
Written with AI assistance.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
decode all 70 entries at 0x4b80 used by the lookup at 0x15d0. preserve lookup order and the parser's uppercase second-letter check. cover missing zones, case handling and prefix matching in guest_rtc on windows.
The seven fixed-unit additions (Ticks, Microseconds, Seconds, Minutes,
Hours, Days, Weeks) now only check the two pointers and store the source
plus the amount modulo 2^64; they no longer return 0x80B50003 for a source
above 9999-12-31 or a result outside the tick range.
sceRtcTickAddMonths and sceRtcTickAddYears no longer reject a source tick
above the 9999 limit. They split the tick into a 16-bit year, add the months
in 32 bits and divide by 12 truncating toward zero. They return 0 without
writing when the 16-bit target year is outside 1 to 9999 or the month sum is
negative and not a multiple of 12; otherwise they write the result.
Observed by executing the code of libSceRtc.sprx from PS5 firmware 3.20 and
4.03 in an emulator with its imports mocked (entry points 0x32c0-0x3440,
0x3470, 0x37f0 on 3.20; 0x3370-0x34f0, 0x3520, 0x3890 on 4.03), not on a
console. Both firmwares give identical results on the same inputs. Current
firmware was not checked.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Require the measured separator after RFC date minutes when seconds are absent. Preserve the destination tick on the parse failure and retain the accepted trailing-space and seconds controls.
AI-assisted; based on guarded PS5 measurements with controlled input backing storage.
Add thirteen offsets measured repeatedly on PS5 firmware 13.42, keeping DST names ahead of their shorter prefixes. Cover case folding, prefix matching and a second valid date.
Written with AI assistance; validated against real hardware and the guest RTC tests.
Measured on a PS5 (firmware 13.60) through dlopen of libSceRtc.sprx.
The weekday is required in any case or length, month names may be
full, RFC 2822 and RFC 850 share one lenient grammar with 2-digit years
split at 50, and the asctime zone is ignored. Zones come from a name
table, a military letter, or +HHMM without a range check. Text the
console rejects returns a parse error with the tick untouched, and an
invalid calendar date returns 0 with only the offset applied to the
tick, as the console does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a PS5 (firmware 13.60) every input that starts with a digit gets the
same result and tick from sceRtcParseDateTime as from
sceRtcParseRFC3339, except that leading spaces and tabs are skipped
first. A string without a zone, or with a space instead of T, is a
parse error rather than UTC.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Measured on a PS5 (firmware 13.60) through dlopen of libSceRtc.sprx:
an empty fraction is accepted, any digits past the sixth are dropped,
text after the zone is ignored, the offset is applied without a range
check, and a 60th second returns 0 with the tick only shifted by the
offset.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A year before 1980 or after 2107 cannot be packed into the DOS time, so
GetDosTime threw. Following the disassembly-derived fpPS4
reimplementation of the PS4 library, it now returns INVALID_YEAR after
writing 0 for an earlier year and 0xff9fbf7d, the largest encodable
time, for a later one. The TechnicalDebt entry now records fpPS4 as the
source for the SetDosTime year decode as well.
Ticks count microseconds since 0001-01-01 in the proleptic Gregorian
calendar, up to 9999-12-31 23:59:59.999999. Implement validation, tick
and date conversion, time_t and Win32 FILETIME conversion, UTC and
local time conversion through the host time zone, RFC 3339 formatting
and parsing, and tick arithmetic. Add sceRtcGetDaysInMonth,
sceRtcTickAddMonths and sceRtcTickAddYears, which clamp the day to the
end of the target month.
The network clock uses the host clock.
Co-Authored-By: Claude Opus 5.5 <[email protected]>