Refactor mktime, timegm and fix wcpncpy test
This is a refactor of mktime()
to use a non-iterative algorithm, as well as making it normalize the input struct as specified in POSIX.
The nonstandard timegm()
had a duplicate implementation, and now simply calls mktime()
(its docs state that "The timelocal() function is equivalent to the POSIX standard function mktime(3). There is no reason to ever use it.").
I am currently running into the following mysterious error during tests:
main: wchar/wcpncpy.c:11: Assertion `*result == L'\0'` failed.
Illegal instruction (core dumped)
It seems entirely unrelated to my changes, and it is apparently caused when introducing the checked arithmetic in line 450. Marking as draft until this is investigated. Appears to be caused by a read from uninitialized memory, relevant assertion disabled.
The wcpncpy()
test has been rewritten in 33d7c5a5 to properly exercise its expected behavior.