On Windows, mktime handed a calendar whose fields were out of range
straight to the UCRT mktime, which refuses a tm_year below 69 before
normalizing. A guest calendar such as year 68 with month 24 (February
1970), or 1969-12-45, therefore returned -1 and left the fields
unchanged, although the date is representable. The libc.prx that titles
ship (PPSA07923, PPSA05916) normalizes and converts these.
mktime already computes the normalized UTC seconds of the fields; it now
rebuilds the host calendar from them whenever the fields are not already
ordinary, not only when the date lies outside the host range.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Guest setenv, putenv and unsetenv only change the guest environment, while
the time conversions read the host TZ, so a guest that set TZ and called
tzset still got host local time. Copy a changed guest TZ to the host before
each local conversion and call tzset again.