From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2219 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: localtime() isn't local Date: Fri, 26 Oct 2012 13:41:30 -0400 Message-ID: <20121026174130.GY254@brightrain.aerifal.cx> References: <20121026075736.GD16801@mahoro.ispfabriek.nl> <20121026081507.GF24157@port70.net> <20121026083405.GE16801@mahoro.ispfabriek.nl> <20121026120025.GG24157@port70.net> <20121026122636.GX254@brightrain.aerifal.cx> <20121026073720.06b2d225.idunham@lavabit.com> <20121026162553.GH24157@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1351273305 10837 80.91.229.3 (26 Oct 2012 17:41:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Oct 2012 17:41:45 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2220-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 26 19:41:53 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TRnun-0004cc-EI for gllmg-musl@plane.gmane.org; Fri, 26 Oct 2012 19:41:49 +0200 Original-Received: (qmail 11644 invoked by uid 550); 26 Oct 2012 17:41:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11636 invoked from network); 26 Oct 2012 17:41:41 -0000 Content-Disposition: inline In-Reply-To: <20121026162553.GH24157@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2219 Archived-At: On Fri, Oct 26, 2012 at 06:25:53PM +0200, Szabolcs Nagy wrote: > * Isaac Dunham [2012-10-26 07:37:20 -0700]: > > FWIW, the last line in /etc/localtime seems in proper format for the TZ variable (that is, export TZ=`tail -n 1 /etc/localtime` should give you a valid POSIX timezone). I don't know why there's so much more cruft, and I've only checked with my timezone. > > > > Isaac Dunham > > that's not always true as the posix tz format > cannot represent any timezone > > in my tzdata files these are counter examples: > [...] The zoneinfo format has several advantages over plain POSIX TZ. The one that affects almost everyone is the ability to represent historical changes in timezones. With POSIX TZ, times in the past will be converted to local time based on the _current_ rules for the user's timezone locality. With zoneinfo, the historical rule in use at the time being converted gets used. In addition, some timezones have rules which are sufficiently arbitrary (and often ridiculous) so as to preclude any simple algorithmic conversion. For those, even present and future dates need the zoneinfo rules for conversion. The format is basically a list of unix time ranges along with offsets that apply for the ranges. Parsing it is mildly painful, but not too bad. At first glance, mmapping the zoneinfo file looks like the best approach. Rich