Today I learned that glibc has a broken %s implementation in strftime. It applies the timezone even when we want UTC...

https://github.com/curl/curl/issues/22038

%time{%s} in --write-out returns wrong epoch on non-UTC hosts · Issue #22038 · curl/curl

I did this Summary curl --write-out '%time{%s}' (and %time{%s.%f}) outputs an epoch value that is offset by the local timezone offset from UTC. On a host in Asia/Shanghai (UTC+8), the value is cons...

GitHub
@bagder How is this broken? It's a non-standard extension to strftime(), so it can be whatever it wants.
@harrysintonen I would still say that applying the timezone is wrong, but sure it's just my opinion. I'm not going to insist

@bagder Man page says "The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). (TZ) (Calculated from mktime(tm).)"

Everything there suggests timezone is applied.

Not even arguing if that makes sense, just that it is documented to do that.

@harrysintonen I'll still claim that is wrong, but documented =)
@bagder @harrysintonen gnu manpages once again serving as a comprehensive bug tracker
@bagder Yeah, a lot of things are documented and still very wrong. :>