Re: [RFC] New Time of day proposal (updated 9/2/04)

Christoph Lameter
2004-09-02T22:55:03Z

On Thu, 2 Sep 2004, john stultz wrote:

> On Thu, 2004-09-02 at 15:09, Christoph Lameter wrote:
> > > timeofday_hook()
> > > now = read(); /* read the timesource */
> > > ns = cyc2ns(now - offset_base); /* calc nsecs since last call */
> > > ntp_ns = ntp_scale(ns); /* apply ntp scaling */
> > > system_time += ntp_ns; /* add scaled value to system_time */
> > > ntp_advance(ns); /* advance ntp state machine by ns */
> > > offset_base = now; /* set new offset_base */
> >
> > This would only work if the precision of the timer used is
> > <=1ns and if you are actually able to caculate the nanoseconds that have
> > passed. What do you do if the interval is lets say 100ns and the time the
> > timeofday hook is being called can be anytime within this 100ns interval
> > since the time source is not always precise?
>
> Well, with the exception of the TSC, none of the current time sources
> have <=1ns resolution, but I'm not sure I understand the problem you're
> trying to point out. Could you clarify?
>
> > I think its unavoidable to do some correction like provided by the time
> > interpolator if the clock source does not provide ns.
>
> Could you point to the specific correction you describe?

I drop my objections. I was thinking too much in terms of the old code....
This should work fine.