Hi,

I was having a problem parsing dates with python in an Alpine container and after some time digging I have found a difference in how musl and glibc calculate the unix Epoch using strftime.

The format specifier to get the unix epoch is "%s", which is an extension of GNU (https://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html).

In Glibc they use mktime (https://github.com/bminor/glibc/blob/master/time/strftime_l.c#L1127), being this function aware of time zone.

In musl is calculated without mktime, adding the seconds of each part of the tm struct (https://git.musl-libc.org/cgit/musl/tree/src/time/strftime.c?h=v1.1.18#n132) and substracting the GMT offset. This method is unaware of the TZ data (I have not seen how to define that gmt offset when using strptime).

Calling directly to musl/mktime work as expected.

I have attached a small program which shows the difference between musl and glibc.

Compiled with glibc:
$ TZ=Europe/Madrid ./a.out
strftime: -3600
mktime: -3600
$ TZ=America/New_York ./a.out
strftime: 18000
mktime: 18000


Compiled with musl:
$ TZ=Europe/Madrid ./a.out  
strftime: 0
mktime: -3600
$ TZ=America/New_York ./a.out
strftime: 0
mktime: 18000


Thanks!
Adrián