Re: [RFC 0/2] ABI for clock_gettime_ns

From: Richard Cochran
Date: Wed Dec 14 2011 - 13:37:35 EST


On Wed, Dec 14, 2011 at 09:15:29AM -0800, Andy Lutomirski wrote:
> On Wed, Dec 14, 2011 at 8:48 AM, john stultz <johnstul@xxxxxxxxxx> wrote:

> > On Wed, 2011-12-14 at 08:46 +0100, Richard Cochran wrote:
> >> Believe it or not, people (from the Test and Measurement field) have
> >> already been asking me about having subnanosecond time values from the
> >> kernel.
>
> I'm curious how that works. My personal record is synchronizing time
> across a bunch of computers to within maybe half a nanosecond, but it
> wasn't the *system* clock that I synchronized -- I just calibrated a
> bunch of oscillator phase differences on ADC clocks that I was using.
> I only relied on the system clock being correct to a few tens of
> microseconds, which is easily done with PTP.

On example to take a look at is the White Rabbit project.

It is possible to time stamp events and apply clock corrections at a
very fine resolution, for example with synchronized Ethernet and PTP.

> What about:
>
> struct sys_timeval {
> u64 nanoseconds; /* unsigned. the current time will always be
> after 1970, and those extra 290 years might be nice. */
> u64 padding; /* for later. currently always zero. */
>
> That way, once there's both an implementation and a use case, we can
> implement it. In the mean time, the overhead is probably immeasurably
> low -- it's a single assignment.

Agreed.

> Note that rdtsc isn't good to a nanosecond, let alone sub-nanosecond
> intervals, on any hardware I've ever seen.

But the hardware is coming, sooner or later.

Richard
--
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/