From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4371 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCHv2] Add support for leap seconds in zoneinfo files Date: Thu, 5 Dec 2013 09:43:11 -0500 Message-ID: <20131205144311.GG24286@brightrain.aerifal.cx> References: <5294EE35.8040603@skarnet.org> <20131126233212.GE24286@brightrain.aerifal.cx> <529570BB.2060804@skarnet.org> <20131127042550.GI24286@brightrain.aerifal.cx> <529588D8.3020006@skarnet.org> <20131127184307.GN1685@port70.net> <52965735.9070409@skarnet.org> <529FD33A.8000509@skarnet.org> 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 1386254598 19670 80.91.229.3 (5 Dec 2013 14:43:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Dec 2013 14:43:18 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4375-gllmg-musl=m.gmane.org@lists.openwall.com Thu Dec 05 15:43:25 2013 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 1Voa9E-0006wC-VF for gllmg-musl@plane.gmane.org; Thu, 05 Dec 2013 15:43:25 +0100 Original-Received: (qmail 3974 invoked by uid 550); 5 Dec 2013 14:43:24 -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 3965 invoked from network); 5 Dec 2013 14:43:23 -0000 Content-Disposition: inline In-Reply-To: <529FD33A.8000509@skarnet.org> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4371 Archived-At: On Thu, Dec 05, 2013 at 01:13:30AM +0000, Laurent Bercot wrote: > The new version of the patch, provided in attachment, reads leap seconds > directly from the mmapped zoneinfo file instead of storing them in a static > table, as requested by Rich; and it's still not invasive. > The leap second table scan is still linear, because: > * when substracting leap seconds, the scan is done from the future to the past. > Since the huge majority of calls involve the current time or a time close to it, > the scan usually stops at the first or second element. > * when adding leap seconds, the scan has to be done from the past to the future > linearly anyway, to apply successive corrections while testing the correct TAI-10 > transition time instead of comparing a UTC value to a TAI-10 value. The previous > version of the patch didn't get this right. > > I would love it if this version, modulo any bugs, could make it into 0.9.15. I don't want to disappoint you but I don't think that's feasible. There's still a lot to be considered about this patch, and it _is_ invasive. The biggest invasive changes are the interface contract violations for gmtime; after the patch: - gmtime depends on the TZ variable - gmtime behaves unpredictably depending on whether a function that loads the timezone has or has not been called prior to calling gmtime. - there's no synchronization in gmtime's (or gmtime_r's) access to the leap seconds data so the latter isn't even thread-safe. There may still be other things too I'm not aware of, but the above are what I noticed immediately. What I can tell you is that this code (the time internals) is not something I expect to make any changes to between now and some time after 1.0, so for your own usage or usage by anybody else who wants it, your patch should continue to apply successfully. And I don't mind further discussion of how to improve it in the mean time, but in the immediate future my focus on musl will be getting 0.9.15 and 1.0.0 releases ready according to the existing plan, without big invasive changes. Rich