tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: strftime(3) oddities with %s, %z
Date: Wed, 26 Oct 2022 04:16:03 +0000
From: David Holland <dholland-tech%netbsd.org@localhost>
Message-ID: <Y1i0g2c3KJLaqpN0%netbsd.org@localhost>
| Where is this documented?
As much as your message can be construed as a complaint about the
documentation, I agree, it should be better.
For most of the rest I'm assuming that you replied to my earliest
message in this thread before you read the rest of them.
| I would expect strftime to print GMT if fed the results of gmtime(),
| and indeed ours does.
As you demonstrated, indeed ours doesn't. It does produce
(not print, strftime() is not an I/O function) what posix
is going to require it to produce in this area however.
Most of the strftime() conversions are indeed just localised
sprintf's (effectively, not literally) of the values in the struct tm,
and work whatever is in the tm (including out of range values being
printed just as they are, even though they make no sense as a date/time,
the conversions to names (%a %b etc) will make "?" if the field (or fields)
concerned is(/are) out of range, and a few of the conversions (%V for
example) seem to simply produce nonsense). %s however is not, it is
(though not in our doc ... see above) specified to produce what mktime()
produces (converted to a string), and is implemented that way.
kre
Home |
Main Index |
Thread Index |
Old Index