mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* New Linux System time proposal
@ 2005-01-11 14:31 linux-os
  2005-01-11 14:58 ` Jan Engelhardt
  2005-01-11 20:09 ` john stultz
  0 siblings, 2 replies; 6+ messages in thread
From: linux-os @ 2005-01-11 14:31 UTC (permalink / raw)
  To: Linux kernel


I think that Linux time should be re-thought and done over once and
for all. I think that time should be the sum of three variables:

 	unsigned boot_time	Read from RTC upon boot and never changed.
 	signed delta_time	Starts at 0, is adjusted as required.
 	unsigned jiffies	Starts at 0 upon boot, bumped by tick only.

Any time there is a requirement to obtain the system time, these
three values are summed. At the time that occurs, the current value
of jiffies is read and compared against a previously-saved value.
The new value is saved in the old value after. If the new jiffies
is less than the old, delta_time is adjusted accordingly.

What this means is that jiffies can remain a 32-bit variable and
one only needs to read the system time once in awhile (before
it wraps twice) to keep everything synchronized.

It also means that hardware time-outs don't get disrupted when
the system clock gets set because jiffies is never touched
except by the timer-tick interrupt.

Also, time doesn't get destroyed in the process of reading it.
A simple user-mode daemon can periodically check certain hardware
timers (like the RTC), and adjust delta_time accordingly (and
slowly, like a PLL). A hook can be provided so that the
delta_time variable can be tweaked by a user-mode code that
synchronizes to time-servers as well. As a side-effect, this
daemon does the "before jiffies wraps" read to keep everything
in sync.

The actual size of the variables boot_time and delta_time can
be determined by the implementor with due consideration for
the resolution required.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.10 on an i686 machine (5537.79 BogoMips).
  Notice : All mail here is now cached for review by Dictator Bush.
                  98.36% of all statistics are fiction.

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

end of thread, other threads:[~2005-01-19 13:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-11 14:31 New Linux System time proposal linux-os
2005-01-11 14:58 ` Jan Engelhardt
2005-01-11 20:09 ` john stultz
2005-01-11 20:58   ` linux-os
2005-01-18 22:21     ` Robert White
2005-01-19 13:56       ` linux-os

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®