Commit Graph

8 Commits

Author SHA1 Message Date
QRMOE 90a14e6a1f
test(libc): cover strftime literal conversions
Exercise unknown, repeated and incomplete conversions, percent escaping and buffer boundaries.

AI-assisted: yes
2026-10-11 16:52:30 +02:00
Hussein Kadhim 84926887e9 fix(libc): keep the literal percent after E and O in strftime
A format such as %E%k is a modified percent sign followed by a literal k, so the second percent must not start a new conversion.
2026-10-11 12:05:00 +02:00
Hussein Kadhim c5bc118f4b fix(libc): accept E and O before new strftime conversions and take %+ zone from tm 2026-10-11 12:05:00 +02:00
Hussein Kadhim 7e3a409022 fix(libc): format %k, %l, %s, %v and %+ in strftime 2026-10-11 12:05:00 +02:00
Adrià Franch ef2d56eb9c feat(libc): implement ctime
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-11 02:58:30 +02:00
Hannah Lyons 502dae1ef3 feat(libc): implement tzset 2026-10-10 18:37:10 -04:00
Mohd Faour 0aae158635 fix(libc): convert times into the guest's 56-byte tm on Windows
gmtime, localtime, mktime, strftime and asctime took and returned the
host std::tm. The guest's FreeBSD tm has tm_gmtoff and tm_zone after the
nine calendar fields, so on Windows, where std::tm is 36 bytes, a title
reading those fields read past the thread-local result, and gmtime_s left
them unwritten. Windows gmtime_s also accepts only 1969-12-31 12:00 to
3001-01-19 21:59 UTC, where the guest libc converts any time.

Convert through a GuestTm with the guest layout on both hosts. Compute
the UTC fields from the day count, so every time whose year fits an int
converts, and on Windows take the local offset and zone name from the
CRT. gmtime reports the zone as UTC like the guest libc. localtime and
mktime keep the CRT's range on Windows; recorded in TechnicalDebt.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 02:13:17 +02:00
Sanjaysrinivas 69901c9ac8 fix(libc): avoid time conversion races 2026-10-07 21:40:31 +02:00