fix(libc): normalize valid mktime minus-one results #3547
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3547"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by BharatYadav007 on 2026-10-11T13:00:38Z.
What
A successful
mktimecan return-1for the second before the Unix epoch. The libc wrapper treated every-1result as a failure and left the guest calendar unnormalized.Initialize the host weekday to an invalid value and treat
-1as failure only if the host conversion leaves that value unchanged. This preserves the guest input on genuine failures and normalizes valid-1results through bothlibc_mktimeandmktime. The distinction follows the documentedtm_wdaycheck in Linux man-pages.Add a runtime test for both exports covering normalization around the epoch, multiple time zones, stale
EOVERFLOW, unrepresentable calendars, and the Windows CRT's existing pre-epoch failure behavior. Windows pre-epoch support remains as documented in TechnicalDebt.Rebased onto upstream main at
a11c8f7f7. Checked 132 open PR heads for overlap before submission; none implements this change.Tested
Time.cppwith the regression fixture and ran it. The unmodified implementation failed at the valid-1timestamp; the fix passed. This was a focused native runtime check, not a full Linux build.guest_mktimepassed in 0.10 s andguest_time_conversionpassed in 0.13 s.libstarget passed.tools/check_conventions.py --base upstream/mainpassed.tools/check_test_registration.py buildpassed; all 638 test executables are registered.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T13:00:50Z.
Thank you for your contribution! Authors with no pull requests merged into
maincan have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-11T13:03:02Z.
Review: COMMENTED
🟢 Approval recommended
The implementation is focused, preserves failure behavior, and includes comprehensive regression coverage.
0 open findings
What changed in this PR
Fixes
mktimehandling for the valid-1epoch-adjacent timestamp while preserving inputs on genuine failures.Changes:
-1results usingtm_wday.core/libs/tests/GuestMktime.cppmktimeregression coverage.core/libs/prx/libc/src/Time.cpp-1results.core/libs/prx/libc/CMakeLists.txt🧠 Review effort: Balanced
💡 Add a
code-reviewagent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.Pull request closed