lkml.org 
[lkml]   [2005]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: New Linux System time proposal
> 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:

It has been rethought a number of times, the last one being the switch to a
64-bit jiffy counter.

> 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.

jiffies is both 32 and 64 at the same time (using some linker magic).

> 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

One can do rdtsc() in kernelspace.

> 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.

I don't see a change necessary unless I'm a physics professor experimenting
with atomic clocks.



Jan Engelhardt
--
ENOSPC
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.072 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site