mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: [PATCH] Add support for leap seconds in zoneinfo files
Date: Tue, 26 Nov 2013 23:25:50 -0500	[thread overview]
Message-ID: <20131127042550.GI24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <529570BB.2060804@skarnet.org>

On Wed, Nov 27, 2013 at 04:10:35AM +0000, Laurent Bercot wrote:
> 
> >By the way, this brings me to one part of the proposed patch that I'd
> >definitely like to see changed: the pre-parsing the leapseconds data
> >and storage in static memory. This both wastes static storage (800
> >bytes for 64-bit systems) and puts an arbitrary limit on the data size
> >where it's not needed. I'd really prefer that the leapsecond
> >processing happen direct from the mmapped space, just like the way
> >time zone transitions are handled.
> 
>  Ok, but that will be more invasive. Time zone transitions can all be
> performed in __secs_to_zone, but leap second data needs to be available
> for __secs_to_tm and __tm_to_secs, since we only want to perform leap
> second calculations when converting from/to broken-down time, not when
> returning raw seconds: so interface changes will be necessary.

__secs_to_tm and __tm_to_secs are not the right places for applying
leap seconds, because they affect gmtime, which is specified strictly
by POSIX to have a particular relationship with time_t...

> >It would also be preferable to use
> >a binary search like what's used on the transition list instead of a
> >linear search; this change to binary search would probably more than
> >compensate for any performance loss from reading directly from the
> >mmapped data.
> 
>  I don't think it's needed. The leap second table is searched in
> descending order, and most calls to time functions are made with the
> current time, or something close to it, so a linear search will stop
> at the first item in most cases. And the rare worst case is only 25
> iterations for now. I'll change to binary search if you insist, but
> I really feel it would add complexity for a very tiny benefit in the
> rare case and no performance increase at all in the common case.

I'm faily indifferent on it, but I don't think the binary search is
significantly more complicated.

Rich


  reply	other threads:[~2013-11-27  4:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 18:53 Laurent Bercot
2013-11-26 18:59 ` Laurent Bercot
2013-11-26 23:32 ` Rich Felker
2013-11-27  1:06   ` Rich Felker
2013-11-27  4:10   ` Laurent Bercot
2013-11-27  4:25     ` Rich Felker [this message]
2013-11-27  5:53       ` Laurent Bercot
2013-11-27 18:43         ` Szabolcs Nagy
2013-11-27 20:33           ` Laurent Bercot
2013-12-05  1:13             ` [PATCHv2] " Laurent Bercot
2013-12-05  5:18               ` Szabolcs Nagy
2013-12-05  8:58                 ` Laurent Bercot
2013-12-05 14:21                   ` Szabolcs Nagy
2013-12-05 14:43               ` Rich Felker
2013-12-05 16:31                 ` Laurent Bercot
2013-12-05 16:40                   ` Rich Felker
2013-12-06  0:36                     ` Laurent Bercot
2013-12-06  0:45                       ` Rich Felker
2013-12-06  1:15                         ` Laurent Bercot
2013-12-06  5:31                           ` Szabolcs Nagy
2013-12-06 10:48                             ` Laurent Bercot
2013-12-06 11:38                               ` Raphael Cohn
2013-12-06 23:29                                 ` Laurent Bercot
2013-12-07  2:31                                   ` Rich Felker
2013-12-07  4:02                                     ` Szabolcs Nagy
2013-12-07  8:52                                     ` Laurent Bercot
2013-12-06  6:29                           ` Rich Felker
2013-12-06 10:37                             ` Laurent Bercot
2013-12-06 12:50                               ` Rich Felker
2013-12-06 13:27                                 ` Szabolcs Nagy
2013-12-06 15:48                                   ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131127042550.GI24286@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).