Commit Graph
45 Commits
Author SHA1 Message Date
Dean f943441744 Merge pull request #10784 from MaxLikesCode/test/rtc-roundtrip-fixed-tick
test(libSceRtc): round-trip a fixed tick through the host's local time
2026-10-25 20:01:35 +13:00
Dean 2400596055 Merge pull request #10642 from maximilianfv/fix/tests-rtc-unique-title-directory
fix(tests): give each RTC test run its own title directory
2026-10-25 19:00:52 +13:00
MaxandClaude Opus 5.5 83cb98a9c6 test(libSceRtc): round-trip a fixed tick through the host's local time
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]>
2026-10-25 02:30:51 +02:00
boykopovar 35cf8d56cd refactor(sdk): add canonical headers for core libraries 2026-10-24 23:17:37 +03:00
Maximilian FleckensteinandClaude Opus 5.5 28f3f43842 fix(tests): give each RTC test run its own title directory
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]>
2026-10-24 11:05:52 -03:00
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
ntamas94andClaude Opus 5.5 16d2cbb4b3 fix(libSceRtc): range-check by the compiled SDK version as the PS4 does
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]>
2026-10-23 17:11:35 +02:00
ntamas94andClaude Opus 5.5 32b7e37d9b Merge main into fix/rtc-ps4-limits
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-23 01:10:40 +02:00
Dean b719e83cdd Merge pull request #9119 from al3w0f205/test/rtc-init-end-and-conf-coverage
test(libSceRtc): cover sceRtcInit and sceRtcEnd lifecycle
2026-10-23 09:40:51 +13:00
ntamas94andClaude Opus 5.5 2d1ecaf29e fix(libSceRtc): reject a negative source tick in sceRtcFormatRFC2822
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]>
2026-10-22 15:52:23 +02:00
ntamas94andClaude Opus 5.5 3cf419d4ea fix(libSceRtc): handle out-of-range time values as the PS4 does
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]>
2026-10-22 15:51:03 +02:00
al3w0f205 6b80e0db06 test(libSceRtc): cover sceRtcInit and sceRtcEnd lifecycle 2026-10-21 17:46:58 -05:00
boykopovar 7e8fede88c fix(rtc): restore the complete system timezone table
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.
2026-10-21 21:44:56 +03:00
orezraeyandClaude Opus 5.5 f6026b24ed Merge main into fix/rtc-format-null-tick-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 03:41:06 -03:00
orezraeyandClaude Opus 5.5 0fffc7bcae fix(libSceRtc): format the current time for a null tick as measured on a PS5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 20:34:05 -03:00
orezraeyandClaude Opus 5.5 3489bf4eb7 fix(libSceRtc): parse the DNT, NFT, NOR and SET zone names as measured on a PS5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 19:45:17 -03:00
Dean d8ae320ca4 Merge pull request #8128 from JAB-dev/debt/rtc-tick-add
fix(libSceRtc): make sceRtcTickAdd* wrap and ignore range like the console
2026-10-20 19:50:06 +13:00
JAB-devandClaude Sonnet 5.5 5f6dee64c4 fix(libSceRtc): make sceRtcTickAdd* wrap and ignore range like the console
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]>
2026-10-20 00:55:55 +02:00
Sergio ec2e056d50 feat(libSceRtc): implement process-local clock setters 2026-10-19 20:55:33 +02:00
Nithishvelan M 160941f812 feat(libSceRtc): implement component getters and setters with range validation 2026-10-19 15:55:05 +05:30
Adrià d937355cb4 Merge pull request #6703 from xXPBSXx/test/rtc-tick-add-units
test(libSceRtc): cover microseconds, minutes, hours and weeks tick addition
2026-10-19 10:43:43 +02:00
xXPBSXxandClaude Sonnet 5.5 f2b580bc32 test(libSceRtc): cover microseconds, minutes, hours and weeks tick addition
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-16 06:57:12 +02:00
Yuri Olive 51e9e5e825 feat(libSceRtc): implement the remaining firmware exports 2026-10-15 18:54:39 -03:00
fogydes 33d93315f7 fix(libSceRtc): use safe tick addition in local clock and validate null pointer checks 2026-10-15 18:10:25 +05:30
Zayd Zaari 396412496f fix(rtc): reject date strings ending at the minutes
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.
2026-10-12 19:44:03 +00:00
Zayd Zaari 4d15f9ef24 fix(rtc): recognize additional measured named time zones
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.
2026-10-11 17:36:41 +00:00
hazzardouslysolid fb1eb20ed4 fix(rtc): floor pre-epoch timestamps for timezone lookup 2026-10-10 09:28:30 +08:00
eljackjoestar-cmd 4dc29440d5 fix(rtc): validate ticks before timezone conversion 2026-10-09 18:20:55 +04:00
Adrià c68c7576b9 Merge pull request #1399 from hugodearaujo/fix/rtc-parse-datetime-rfc2822-hardware
fix(rtc): parse RFC 2822, RFC 850 and asctime text like the console
2026-10-08 15:05:42 +02:00
Adrià 09a17e963a Merge pull request #1398 from hugodearaujo/fix/rtc-parse-datetime-iso-hardware
fix(rtc): parse ISO text in sceRtcParseDateTime by the RFC 3339 rules
2026-10-08 14:56:12 +02:00
Dean a57ccfb426 Merge pull request #1275 from KSWORK2001/fix/libscertc-dostime-range
fix(libSceRtc): answer out-of-range years in sceRtcGetDosTime
2026-10-08 19:35:43 +13:00
hugodearaujoandClaude Opus 5.5 a156104cba fix(rtc): parse RFC 2822, RFC 850 and asctime text like the console
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]>
2026-10-07 19:08:10 -03:00
hugodearaujoandClaude Opus 5.5 32dd014efe fix(rtc): parse ISO text in sceRtcParseDateTime by the RFC 3339 rules
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]>
2026-10-07 19:04:17 -03:00
hugodearaujoandClaude Opus 5.5 fcfe9b56a3 fix(rtc): match sceRtcParseRFC3339 to the console
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]>
2026-10-07 19:04:17 -03:00
Karan Shrivastava 954d6f19b1 fix(libSceRtc): answer out-of-range years in sceRtcGetDosTime
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.
2026-10-07 17:18:42 -04:00
Adrià FranchandClaude 0781225d43 fix(rtc): decode the DOS year as unsigned, move TechnicalDebt line
Co-Authored-By: Claude <[email protected]>
2026-10-07 18:06:11 +02:00
Adrià FranchandClaude c94949aedb feat(rtc): implement sceRtcGetDosTime and sceRtcSetDosTime
Co-Authored-By: Claude <[email protected]>
2026-10-07 17:52:56 +02:00
Dean 1e6b1cb7eb Merge pull request #804 from adriadam10/feat/rtc-format-rfc2822
feat(rtc): implement sceRtcFormatRFC2822 and the RFC 2822/3339 local-time formatters
2026-10-06 22:31:59 +13:00
Adrià FranchandClaude 3515ead91a feat(rtc): implement sceRtcFormatRFC2822 and the RFC 2822/3339 local-time formatters
Co-Authored-By: Claude <[email protected]>
2026-10-06 07:27:27 +02:00
Adrià FranchandClaude 4e5a1fe9d4 feat(rtc): parse RFC 2822 and asctime strings in sceRtcParseDateTime
Co-Authored-By: Claude <[email protected]>
2026-10-06 07:16:02 +02:00
Tomás Ortellado 3a30b5bae0 fix(rtc): reject invalid RFC 3339 formatting offsets 2026-10-05 08:37:55 -03:00
Nicolas Abosch 76b7294f06 fix(rtc): reject out-of-range source ticks in date arithmetic 2026-10-05 00:15:57 -03:00
Pouare514 e67d50cb2f fix(libs): route DateTime zone suffix through RFC3339 path, throw on unverified shapes 2026-10-05 01:10:25 +02:00
RomainROCH 44c9c77a7c fix(rtc): reject invalid RFC 3339 timezone offsets 2026-10-03 04:08:27 +02:00
PacukaandClaude Opus 5.5 c0508a7f5f feat(rtc): implement libSceRtc date and tick functions
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]>
2026-09-26 12:21:23 +02:00