[lkml]   [2003]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectClock monotonic a suggestion
In an effort to get better resolution and to get CLOCK_MONOTONIC to 
better track CLOCK_REALTIME, I would like to do the following:

Define CLOCK_MONOTONIC to be the same as
(gettimeofday() + wall_to_monotonic).

Wall_to_monotonic would be defined at boot time as -(gettimeofday())
at that time and would be updated each time the wall clock is set.
Currently this happens in only three places in the kernel, two in the
wall clock update routine (a leap second can be added or subtracted)
and in settimeofday(). The update of wall_to_monotonic must be done
under the xtime lock, as should the add to convert gettimeofday() to

What this gets us is:

Both clocks will tick at the same rate, even under NTP corrections.
The conversion is a simple (well almost simple) add.
Both clocks will have the same resolution.


George Anzinger
Preemption patch:

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:34    [W:0.063 / U:1.752 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site