Skip to content

fix(rtc): floor pre-epoch timestamps for timezone lookup - #2531

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
hazzardouslysolid:fix/rtc-pre-epoch-timezone
Oct 11, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
hazzardouslysolid:fix/rtc-pre-epoch-timezone

Conversation

@hazzardouslysolid

Copy link
Copy Markdown
Contributor

What

Floor pre-epoch tick values to whole seconds before the timezone lookup in localOffsetSeconds. Integer division truncated toward zero, so a valid timestamp shortly before a DST transition at the Unix epoch selected the later (DST) offset instead of the earlier one, producing a one-hour error.

Tested

  • mogus-nix, x86-64, NixOS 26.11, GCC 15.3.0; full Release build plus the libs target, with this change merged into upstream main fc063cff (retaining the fix(rtc): validate ticks before timezone conversion #2286 regression checks).
  • guest_rtc passes, including synthetic pre-transition, exact-second, after-transition, in-place and local-formatting cases under TZ=STD0DST,J1/0,J2/0.
  • Negative control: with the new tests kept and only core/libs/prx/libSceRtc/Export.cpp reverted to main, guest_rtc aborts.
  • python3 tools/check_conventions.py --base main passes.

The synthetic DST-transition regression is POSIX-only (#ifndef _WIN32); Windows CRT does not support negative epoch dates. This changes host lookup rounding for valid pre-1970 timestamps; it does not add Windows historical-date support.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@github-actions github-actions Bot added prx intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main labels Oct 10, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

@github-actions github-actions Bot closed this Oct 10, 2026
@oneandonlydean oneandonlydean removed the intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main label Oct 11, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on Linux: the merged tree builds, guest_rtc passes, and it fails when only Export.cpp is reverted, so the new cases pin the fix. Flooring to whole seconds before localtime_r is the right rounding for pre-epoch ticks. Conventions check is green; merging.

@adriadam10
adriadam10 merged commit ca898cf into boykopovar:main Oct 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants