feat(libc): implement ctime #3201

Merged
adriadam10 merged 1 commit from upstream-pr/3201 into main 2026-10-11 01:06:02 +00:00
adriadam10 commented 2026-10-11 00:59:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T00:59:10Z.


What

ctime (0uAUs3hYuG4, imported from libSceLibcInternal) isn't exported. Since #1529, Linux binds libSceLibcInternal imports to the system libraries, so two catalog homebrew titles stop on it at load on main:

Title Stop on main f1ae427b6
ccleste (PPSA59322) ./app.elf: symbol lookup error: ./app.elf: undefined symbol: 0uAUs3hYuG4
RommPS (PPSA76677) same

It follows FreeBSD 11 tzcode (contrib/tzcode/stdtime/localtime.c ctime, asctime.c asctime_r): ctime(t) is asctime(localtime(t)), built from the existing localtime and asctime. When localtime can't represent the time, tzcode's asctime gets a null tm. It then returns "??? ??? ?? ??:??:?? ????\n" and sets EINVAL, and so does this ctime.

Tested

Linux (CachyOS), GCC 16, Release.

  • guest_time_conversion passes. The new cases, all with TZ=UTC-2:
    • the epoch gives "Thu Jan 1 02:00:00 1970\n", in local time;
    • 2000-02-29 13:04:05 UTC gives "Tue Feb 29 15:04:05 2000\n";
    • INT64_MIN gives the ??? string with errno 22.
  • On main the test doesn't link.
  • Negative checks, each one makes the test fail: using UTC instead of local time, dropping EINVAL, and a wrong placeholder.
  • Title stops: catalog releases (sha256-checked) relinked for Linux with main's relinker and launched. Both stop at load with the line above.
  • tools/check_conventions.py passes.

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 (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4815628296 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3201). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T00:59:10Z. --- ### What `ctime` (`0uAUs3hYuG4`, imported from `libSceLibcInternal`) isn't exported. Since #1529, Linux binds `libSceLibcInternal` imports to the system libraries, so two catalog homebrew titles stop on it at load on `main`: | Title | Stop on `main` f1ae427b6 | |---|---| | ccleste (PPSA59322) | `./app.elf: symbol lookup error: ./app.elf: undefined symbol: 0uAUs3hYuG4` | | RommPS (PPSA76677) | same | It follows FreeBSD 11 tzcode (`contrib/tzcode/stdtime/localtime.c` `ctime`, `asctime.c` `asctime_r`): `ctime(t)` is `asctime(localtime(t))`, built from the existing `localtime` and `asctime`. When `localtime` can't represent the time, tzcode's `asctime` gets a null `tm`. It then returns `"??? ??? ?? ??:??:?? ????\n"` and sets `EINVAL`, and so does this `ctime`. ### Tested Linux (CachyOS), GCC 16, Release. - `guest_time_conversion` passes. The new cases, all with `TZ=UTC-2`: - the epoch gives `"Thu Jan 1 02:00:00 1970\n"`, in local time; - 2000-02-29 13:04:05 UTC gives `"Tue Feb 29 15:04:05 2000\n"`; - `INT64_MIN` gives the `???` string with `errno` 22. - On `main` the test doesn't link. - Negative checks, each one makes the test fail: using UTC instead of local time, dropping `EINVAL`, and a wrong placeholder. - Title stops: catalog releases (sha256-checked) relinked for Linux with `main`'s relinker and launched. Both stop at load with the line above. - `tools/check_conventions.py` passes. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-11 00:59:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T00:59:30Z.


Progress report (06da117 → ef2d56e)

➖ System libraries: 85.96% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libc ctime_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103988057 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3201#issuecomment-6103988057). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T00:59:30Z. --- <!-- progress-report --> ### Progress report (06da117 → ef2d56e) ➖ **System libraries**: 85.96% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libc | `ctime_nid_postfix` | </details>
adriadam10 commented 2026-10-11 01:14:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T01:14:22Z.


Merged with Linux CI red only on the three AGC tests main has been failing since 3c46fa6f4 (agc_unit_shadow, agc_driver_flat_apertures, agc_driver_image_packed16_load; the last one is fixed in #3208). Windows passed, and guest_time_conversion passed on both.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104095597 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3201#issuecomment-6104095597). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T01:14:22Z. --- Merged with Linux CI red only on the three AGC tests main has been failing since 3c46fa6f4 (`agc_unit_shadow`, `agc_driver_flat_apertures`, `agc_driver_image_packed16_load`; the last one is fixed in #3208). Windows passed, and `guest_time_conversion` passed on both.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3201
No description provided.