From: Colin Plumb <colin@nyx.net>
To: tytso@MIT.EDU
Cc: andrejp@luz.fe.uni-lj.si, linux-kernel@vger.rutgers.edu
Subject: Re: GPS Leap Second Scheduled!
Date: Wed, 9 Sep 1998 14:13:42 -0600 (MDT) [thread overview]
Message-ID: <199809092013.OAA10252@nyx10.nyx.net> (raw)
> Hence, the above equation would have the same value for 23:59:60 and
> 00:00:00 on the next day. Hence, time() should return the same value.
The problem becomes more acute for gettimeofday() and the POSIX
ns-resolution equivalent, clock_gettime(CLOCK_REALTIME).
There are a few axioms that you'd like to have hold:
- time() and gettimeofday() return the same time as
clock_gettime(CLOCK_REALTIME), as far as precision permits.
- gettimeofday() never returns the same value twice (documented BSD behaviour)
- no clock ever runs backwards
This makes the handling of the tv_usec or tv_nsec parts of the time during
a leap second a bit problematic.
One option is to count twice.
One option is to count at half speed during 23:59:60 and 0:00:00.
One option is to use the curve y = 1/4*x^3 - 3/4*x^2 + x to interpolate
y smoothly from 0 to 1 as x goes from 0 to 2.
One option is to freeze the fractional part fr one of the two seconds.
One (pretty rude) option is to count tv_usec from -1000000 to -1
during 23:59:60. (tv_usec is a *signed* long.)
I don't know of a pretty way. What I'd like, as I said, is a defined kludge,
so that there is a defined mapping between struct timeval and struct timespec
and UTC in the vicinity of a leap second. This ensures that timestamps
collected on different machines can at least be compared, even if the
time intervals reported are incorrect. ("Why were my ping times
half of usual at midnight last night?")
--
-Colin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/faq.html
next reply other threads:[~1998-09-09 18:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-09-09 20:13 Colin Plumb [this message]
1998-09-09 23:45 ` Chris Wedgwood
1998-09-09 23:55 ` Chris Wedgwood
1998-09-10 8:36 ` Rogier Wolff
1998-09-10 17:05 ` Oliver Xymoron
1998-09-10 22:02 ` Ryan Moore
[not found] <19980914165757.A17479@tantalophile.demon.co.uk>
[not found] ` <199809150603.XAA29073@cesium.transmeta.com>
[not found] ` <19980915100729.02790@albireo.ucw.cz>
[not found] ` <35FF1838.6E247F0C@his.com>
1998-09-17 11:51 ` Jan Echternach
-- strict thread matches above, loose matches on Subject: below --
1998-09-11 22:49 Ethan O'Connor
[not found] <no.id>
1998-09-10 6:34 ` Jamie Lokier
1998-09-11 6:18 ` Michael Shields
1998-09-09 4:46 Colin Plumb
1998-09-09 19:08 ` Theodore Y. Ts'o
[not found] <299BBE59294E@rkdvmks1.ngate.uni-regensburg.de>
[not found] ` <98090822315400.00819@soda>
1998-09-09 0:59 ` H. Peter Anvin
1998-09-09 8:00 ` Chris Wedgwood
[not found] ` <199809092149.RAA06993@hilfy.ece.cmu.edu>
1998-09-10 1:37 ` H. Peter Anvin
1998-09-10 15:05 ` Theodore Y. Ts'o
1998-09-12 19:57 ` Feuer
1998-09-09 16:35 ` David Lang
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=199809092013.OAA10252@nyx10.nyx.net \
--to=colin@nyx.net \
--cc=andrejp@luz.fe.uni-lj.si \
--cc=linux-kernel@vger.rutgers.edu \
--cc=tytso@MIT.EDU \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®