Hi,

Currently, strftime() %Z will print an empty string if the provided tm_zone does not originate from musl. It appears that this behavior is explicitly implemented in __tm_to_tzname(). Would it be possible to instead print any non-NULL tm_zone as provided?

For consumers manually populating the struct tm structure, it is non-trivial to work around the current behavior. Python introduced a work around in https://github.com/python/cpython/commit/163eca34c48f1b25e1504e37f4656773fd0fdc78, but it is not easy to generalize.

From what I gathered, the original concern here was that a consumer manually initializing struct tm may not initialize the tm_zone field. As struct tm is only specified to contain "at least" certain members, manual initialization of this structure is already on shaky ground anyway and I think it is more useful to assume the initialization is correct than try to deal with garbage data. Because other libc implementation do not try to validate the pointer either (beyond being non-NULL), incorrect initialization is unlikely in practice.

Regards,
Nikita