Repository navigation
fix(libc): format strftime and asctime as FreeBSD 11 does - #4543
Merged
Merged
Conversation
6 tasks done
coltken95
force-pushed
the
fix/libc-time
branch
from
October 12, 2026 18:45
615e0ff to
f3850d1
Compare
10 tasks done
Collaborator
Contributor
|
Tested on Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release: this PR merged onto
Not tested: Linux, a console, a title run. AI-assisted (Claude Code). |
coltken95
force-pushed
the
fix/libc-time
branch
from
October 13, 2026 08:31
f3850d1 to
b9c201c
Compare
10 tasks done
strftime handed most conversions to the host's strftime, which differs from FreeBSD 11's for E and O modifiers on conversions glibc does not pair with them (%Ea was printed literally), padding flags on %+ and %v, years outside 1000 to 9999 (%Y printed 899 and -1 where FreeBSD prints 0899 and -001), and out-of-range fields (%I of hour 100, %u of weekday 8). On Windows the padding flags printed nothing. strftime now follows FreeBSD 11 strftime.c with the C locale on every host, and asctime follows FreeBSD 11 asctime.c, padding years to four digits and setting longer years apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VZWLdTjf1S57iLgn2rcaFb
coltken95
force-pushed
the
fix/libc-time
branch
from
October 13, 2026 10:17
b9c201c to
d0df62b
Compare
Author
|
Rebased onto 77b9f72. The AI-assisted: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
strftime(libc) handed most conversions to the host'sstrftime, which differs from FreeBSD 11's:EandOwith conversions glibc does not pair them with were printed literally (%Ea,%OX,%OD,%OF).%Yprinted899and-1where FreeBSD prints0899and-001;%C,%y,%G,%g,%F,%c,%Dand%vfollowed.%Iof hour 100 gave88(FreeBSD04),%uof weekday 8 gave1(FreeBSD8), and%Wdiffered.%+and%vleft them unexpanded (%_+printed literally); on Windows the%-,%_and%0flags printed nothing.asctimeprinted the year as a plain number; FreeBSD formats it with%Y(0899) and sets years longer than four digits apart (12345).strftimenow follows FreeBSD 11 strftime.c with the C locale on both hosts, andasctimefollows asctime.c.%skeeps the guest's local-timemktime. The TechnicalDebt entry is rewritten; the Windows gaps it listed are gone, and that the console's libc uses this code is recorded as not measured.Tested
Linux (Ubuntu 24.04, GCC 13.3). Compared against FreeBSD 11
strftime.candasctime.ccompiled as references: 500000 random cases (every conversion, padding flag,E/Omodifier and unknown character, out-of-range fields, years from -2147481748 to 2147485547, short buffers), in UTC and America/New_York; no differences. Newguest_strftimetest (one case per difference above, short buffer, null format, bothasctimelayouts); it fails before this change and passes after. All 44 libcguest_*tests registered in this configuration, plusguest_crtandguest_rtc, pass. Windows not built locally (no MinGW toolchain available). No title tested.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)