[lkml]   [2001]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Anyone else interested in a high-precision monotonic counter?
"Christopher Friesen" <> writes:

> Has anyone ever considered including a microsecond-precision
> monotonically-increasing counter in the kernel? This would allow for
> easy timing of alarms and such by using absolute values of when the
> alarm should expire rather than a list of deltas from previous alarms.
> The thing I have in mind would store a value something like "xtime"
> (maybe call it "ytime"?) in the kernel. This value would be initialized
> to zero on startup, and would be incremented at the same time as
> "xtime". However, while "xtime" reflects adjustments to the actual
> system time (settimeofday(), date, ntp, etc.), this value would not.
> Finally, it would be accessed with a system call essentially identical
> to sys_gettimeofday(), only it would access "ytime" instead of "xtime"
> before going down and getting the microseconds from the RTC.
> This doesn't seem to me as though it would be all that tricky to add,
> and I could see it being very useful in providing a timing source that
> is guaranteed to
> a) be accurate to microseconds and
> b) never go backwards.

Why a new system call?

regarding a: it could have microsecond resolution but not
microseconds accuracy.
regarding b: have you looked at the return-value of times(2)
Or roll your own using setitimer(2)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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