From: Laurent Bercot <ska-dietlibc@skarnet.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] Add support for leap seconds in zoneinfo files
Date: Wed, 27 Nov 2013 05:53:28 +0000 [thread overview]
Message-ID: <529588D8.3020006@skarnet.org> (raw)
In-Reply-To: <20131127042550.GI24286@brightrain.aerifal.cx>
> __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...
I disagree that they are not the right place for it.
* the point of using TAI-10 instead of UTC is to have a linear system
clock, so leap seconds must not be applied to clock_gettime() and
friends.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/time.html and
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15
are vague enough ("approximate the number of seconds that have elapsed since
the Epoch") for TAI-10 to be a compliant setup here. The numerical relationship
between number of seconds and broken-down time is not respected if there are
leap seconds, but:
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/gmtime.html
makes it very clear that gmtime() should return UTC, and user applications
like "date" rely on it, so if there are leap seconds, they should definitely
be applied here;
* POSIX followers will use posix/ timezones with 0 leap seconds anyway,
so the numerical relationship will be respected.
To sum it up:
- leap seconds break POSIX anyway, but should break as little as possible
- leap second users only care about system clock time, not broken-down time
- so gmtime() should always return UTC, this is relied on by userland so
it's more important than the exact relationship between tm and secs
- so time() should ignore leap seconds but broken-down time should apply them
- so the right place to apply them is in __secs_to_tm and __tm_to_secs, the
conversion routines
- using a posix/ zone will make everything POSIX in any case.
--
Laurent
next prev parent reply other threads:[~2013-11-27 5:53 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
2013-11-27 5:53 ` Laurent Bercot [this message]
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=529588D8.3020006@skarnet.org \
--to=ska-dietlibc@skarnet.org \
--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).