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

From: Christoph Lameter
Date: Thu Sep 02 2004 - 17:58:35 EST


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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/