All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC V1 0/5] Rationalize time keeping
@ 2012-04-27  8:12 Richard Cochran
  2012-04-27  8:12 ` [PATCH RFC V1 1/5] Add functions to convert continuous timescales to UTC Richard Cochran
                   ` (6 more replies)
  0 siblings, 7 replies; 28+ messages in thread
From: Richard Cochran @ 2012-04-27  8:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Stultz, Thomas Gleixner

Just in time for this year's leap second, this patch series presents a
solution for the UTC leap second mess.

Of course, the POSIX UTC system is broken by design, and the Linux
kernel cannot fix that. However, what we can do is correctly execute
leap seconds and always report the time variables (UTC time, TAI
offset, and leap second status) with consistency.

The basic idea is to keep the internal time using a continuous
timescale and to convert to UTC by testing the time value against the
current threshold and adding the appropriate offset. Since the UTC
time and the leap second status is provided on demand, this eliminates
the need to set a timer or to constantly monitor for leap seconds, as
was done up until now.

Patches 2 and 3 are just trivial stuff I saw along the way.

* Benefits
  - Fixes the buggy, inconsistent time reporting surrounding a leap
    second event.
  - Opens the possibility of offering a rational time source to user
    space. [ Trivial to offer clock_gettime(CLOCK_TAI) for example. ]

* Performance Impacts
** con
   - Small extra cost when reading the time (one integer addition plus
     one integer test).
** pro
   - Removes repetitive, periodic division (secs % 86400 == 0) the whole
     day long preceding a leap second.
   - Cost of maintaining leap second status goes to the user of the
     NTP adjtimex() interface, if any.

* Todo
  - The function __current_kernel_time accesses the time variables
    without taking the lock. I can't figure that out.


Richard Cochran (5):
  Add functions to convert continuous timescales to UTC.
  ntp: Fix a stale comment and a few stray newlines.
  timekeeping: Fix a few minor newline issues.
  timekeeping: Offer an interface to manipulate leap seconds.
  timekeeping: Use a continuous timescale to tell time.

 include/linux/timex.h      |    2 +-
 kernel/time/Kconfig        |   12 ++
 kernel/time/leap-seconds.h |   23 ++++
 kernel/time/ntp.c          |   87 ++++------------
 kernel/time/timekeeping.c  |  252 +++++++++++++++++++++++++++++++++++++++++---
 kernel/time/utc-tai.h      |   99 +++++++++++++++++
 6 files changed, 391 insertions(+), 84 deletions(-)
 create mode 100644 kernel/time/leap-seconds.h
 create mode 100644 kernel/time/utc-tai.h

-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2012-05-28 16:49 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-27  8:12 [PATCH RFC V1 0/5] Rationalize time keeping Richard Cochran
2012-04-27  8:12 ` [PATCH RFC V1 1/5] Add functions to convert continuous timescales to UTC Richard Cochran
2012-04-27  8:12 ` [PATCH RFC V1 2/5] ntp: Fix a stale comment and a few stray newlines Richard Cochran
2012-04-27 22:25   ` John Stultz
2012-04-27  8:12 ` [PATCH RFC V1 3/5] timekeeping: Fix a few minor newline issues Richard Cochran
2012-04-27 22:25   ` John Stultz
2012-04-27  8:12 ` [PATCH RFC V1 4/5] timekeeping: Offer an interface to manipulate leap seconds Richard Cochran
2012-04-27 23:08   ` John Stultz
2012-04-28  8:47     ` Richard Cochran
2012-05-05 10:17     ` Richard Cochran
2012-05-07 17:36       ` John Stultz
2012-04-27  8:12 ` [PATCH RFC V1 5/5] timekeeping: Use a continuous timescale to tell time Richard Cochran
2012-05-28 16:49   ` Richard Cochran
2012-04-27 22:49 ` [PATCH RFC V1 0/5] Rationalize time keeping John Stultz
2012-04-28  8:04   ` Richard Cochran
2012-04-30 20:56     ` John Stultz
2012-05-01  7:17       ` Richard Cochran
2012-05-01  8:01         ` John Stultz
2012-05-01 18:43           ` Richard Cochran
2012-05-03  7:02       ` Richard Cochran
2012-05-03 15:48         ` John Stultz
2012-05-03 18:21   ` Richard Cochran
2012-05-03 18:44     ` John Stultz
2012-05-03 19:28       ` Richard Cochran
2012-05-03 19:42         ` John Stultz
2012-05-03 19:57 ` John Stultz
2012-05-05  7:34   ` Richard Cochran
2012-05-05 19:25     ` John Stultz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.