Repository navigation
feat(libc): implement timelocal - #11843
Conversation
|
@heditrigui Please check timelocal against FreeBSD 11.4 lib/libc/stdtime/localtime.c. If it sets tm_isdst = -1 before converting, as I expect, do the same (and keep the failure path leaving the struct unchanged apart from that), and add a case under a DST zone such as EST5EDT where the input has tm_isdst 0 or 1 in summer, comparing timelocal with mktime. If the source shows a plain alias, say so in the debt entry and cite the line. |
|
@oneandonlydean Checked FreeBSD 11 (contrib/tzcode/stdtime/localtime.c lines 2126-2132): timelocal indeed sets tmp->tm_isdst = -1 before calling mktime. Updated timelocal to set tm_isdst = -1 (preserving input fields on failure), cited lines 2126-2132 in the technical debt entry, and added CheckTimelocalDst in GuestMktime.cpp verifying under EST5EDT that summer input with tm_isdst=0 produces the active EDT timestamp (1 hour earlier than mktime's forced standard-time result). |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release,
AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
@maskym Thanks for running and pointing out the Windows mktime struct rebuild behavior with localtime_s in Time.cpp! Dropped the over-specified forMktime.tm_isdst == 0 assertion, keeping the DST-vs-standard conversion return values and forTimelocal.tm_isdst == 1 verification. |
|
Retested head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release,
AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
Linux result (the runs so far are Windows only; the Setup: Ubuntu 22.04 under WSL2, GCC 11.4.0, glibc 2.35, Ninja Release, Test: No control: Not tested: macOS, any title. AI-assisted (Claude Code). |
2dc7988 to
4307d56
Compare
|
@heditrigui Thank you for adding the summer-time case under EST5EDT. On the Windows run for 4307d56 (job 558,
The two checks before it pass on Windows ( Please make the test independent of that host behaviour. Either drop the No change to |
4307d56 to
9baa878
Compare
|
@oneandonlydean Thanks! Guarded the host mktime forced standard time comparison under #ifndef _WIN32\ in \GuestMktime.cpp\ as suggested, keeping the test independent of Windows host \mktime\ behavior while retaining the \ imelocal\ summer normalization and unrepresentable date checks on every platform. Rebased cleanly onto latest upstream/main. |
|
Retested head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, The tree also carried the open PR #13455, merged cleanly. AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
What
Implement
timelocalinlibcas an alias tolibc_mktime_nid_postfixmatching FreeBSD/POSIX behavior, and add test coverage inGuestMktime.cpp.Tested
Ran
python tools/check_conventions.py --base upstream/maincleanly (0 errors).Ran
python core/libs/tests/test_public_headers.py --audit-onlycleanly.Ran
python tools/progress.pyverifying progress increase (libraries 6567/13449 -> 6568/13450).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)