Skip to content

libc: wcsftime is absent (PS5MC); fix branch ready #3625

Closed

Description

@screamm

libc (libSceLibcInternal) does not export wcsftime (NID XbVXpf5WF28). From the relink registry order it is a predicted stop of PS5MC (PPSA99420, index 481); not yet observed in a run.

Fix branch ready: screamm:feat/libc-wcsftime (06ed477e, one commit on main a11c8f7f). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is.

  • wcsftime(buf, maxsize, format, tm) in Time.cpp follows FreeBSD 11.4 lib/libc/locale/wcsftime.c (8c639945) step by step over the repository's own wcsrtombs, strftime and mbsrtowcs with the 16-bit guest wchar_t in the C locale (none.c/table.c, the only locale setlocale accepts here): a format character above 255 returns 0 with EILSEQ, an unrepresentable maxsize * MB_CUR_MAX returns 0 with EINVAL, allocation failure ENOMEM; an empty result, a result that does not fit and a null buffer return 0 with errno unchanged and the buffer untouched; null format or tm throw (FreeBSD dereferences both). One host difference found and contained: the Windows CRT strftime sets ERANGE/EINVAL on overflow or zero size where FreeBSD's does not, so wcsftime restores errno around the call (the guest strftime export still leaks those values; left for a separate change). TechnicalDebt records the sources.
  • guest_wide_formatting compares wcsftime with strftime unit by unit for a fixed tm over the common conversions, a Latin-1 round trip, pinned outputs, the zero-return cases with errno kept, EILSEQ, EINVAL and the throws.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_wide_formatting and guest_time_conversion 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 533/536, the failures being the known windows_exceptions (#3411), guest_kernel_sys (#3510) and guest_filesystem (#3518); with main's Time.cpp the extended test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

Activity

  1. LeandroLP23 commented on Oct 13, 2026

    @LeandroLP23
    Contributor

    wcsftime is on main since #4226 (merged 2026-10-13), and its NID is in the built libc.prx exports. Build of main 0f2683cb7 (Windows, WinLibs GCC 15.2.0, Release), checked with objdump -p on the built modules. #4226 didn't use a closing keyword, so this stayed open. Could a maintainer close it?

  2. oneandonlydean commented on Oct 14, 2026

    @oneandonlydean
    Collaborator

    wcsftime is on main since #4226. Closing; comment here if PS5MC still stops on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions