Date: Tue, 25 Jul 2000 13:46:16 +0200 From: Phil Pennock <pdp@nl.demon.net> To: Bernd Luevelsmeyer <bernd.luevelsmeyer@heitec.net> Cc: freebsd-bugs@FreeBSD.org Subject: Re: misc/20159: strftime() can't produce ISO8601 format timezone representation Message-ID: <20000725134616.A71153@samhain.noc.nl.demon.net> In-Reply-To: <397CD82D.F67AA13E@heitec.net>; from "Bernd Luevelsmeyer" on Tue 25 Jul 2000 (01:58 %2B0200) References: <E13GqO3-000HRe-00@samhain.noc.nl.demon.net> <200007242210.PAA15988@freefall.freebsd.org> <20000725002527.A67116@samhain.noc.nl.demon.net> <397CD82D.F67AA13E@heitec.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2000-07-25 at 01:58 +0200, Bernd Luevelsmeyer wrote: > According to the new C Standard (C99), %z is supposed to be replaced by Coo - and thanks for the PDF reference. I'll read C99 RSN. > "the offset from UTC in the ISO 8601 format ``0430'' (meaning 4 hours > 30 minutes behind UTC, west of Greenwich), or by no characters if no > time zone is determinable." It's not determinable if tm_isdst is > negative. The patch is trivially modifiable to do this "no characters", now that the nudge has been given to provide it. > %Z ought to be replaced by "the locale's time zone name or abbreviation, > or by no characters if no time zone is determinable.". The names are > locale-dependent, and in the C locale they are implementation-defined. > > In the old Standard (C89) %z is undefined, and %Z is defined to be > replaced by "the time zone name, or by no characters if no time zone is > determinable." The current implementation does not follow either standard. If tm_isdst is 0 or 1, then the timezone is inserted, otherwise the character '?'. The timezone name is drawn from the discouraged[*] tzname[] and not the char *tm_zone member - which only seems to make sense if you don't trust tm_zone to have been set. [*] ctime(3) BUGS section > I think if strftime() were to be modified then the implementation ought > to follow the C99 Standard. Fine by me. Would you like an alternate patch, or is the one which I supplied an adequate base? > FreeBSD's not documenting may be due to the fact that the system is > always running in a known TZ, defaulting to UTC. So is there a supported method for an application which doesn't want to reveal its timezone to do this with strftime(), other than just hardcoding the string -0000 into the format string and handling this logic at a higher level? The use of -0000 comes from use in various rfc822-style headers - primarily Received: - although I don't have a handy reference indicating the appropriate RFC - it's not 822. -- Phil Pennock <pdp@nl.demon.net> <Phil.Pennock@thus.net> Demon Internet Nederland -- Network Operations Centre -- Systems Administrator Libertes philosophica. Sales: +31 20 422 20 00 Support: 0800 33 6666 8 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000725134616.A71153>