From owner-freebsd-bugs Tue Jul 25 4:47:13 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from hermes.mail.nl.demon.net (hermes.mail.nl.demon.net [194.159.72.197]) by hub.freebsd.org (Postfix) with ESMTP id 13C7137BD27 for ; Tue, 25 Jul 2000 04:47:05 -0700 (PDT) (envelope-from pdp@nl.demon.net) Received: from samhain.noc.nl.demon.net ([194.159.72.214] ident=exim) by hermes.mail.nl.demon.net with esmtp (Exim 3.16 #1) id 13H3A8-000PtC-00; Tue, 25 Jul 2000 13:46:16 +0200 Received: from pdp by samhain.noc.nl.demon.net with local id 13H3A8-000IX4-00 for multiple recipients; Tue, 25 Jul 2000 11:46:16 +0000 Date: Tue, 25 Jul 2000 13:46:16 +0200 From: Phil Pennock To: Bernd Luevelsmeyer 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> References: <200007242210.PAA15988@freefall.freebsd.org> <20000725002527.A67116@samhain.noc.nl.demon.net> <397CD82D.F67AA13E@heitec.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2i In-Reply-To: <397CD82D.F67AA13E@heitec.net>; from "Bernd Luevelsmeyer" on Tue 25 Jul 2000 (01:58 +0200) Organisation: Demon Internet Netherlands Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 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