[LinuxPPS] Timestamps with LinuxPPS

Bernhard Schiffner bernhard at schiffner-limbach.de
Thu Mar 18 20:21:36 CET 2010


On Thursday, 18. March 2010 19:05:10 john stultz wrote:
> On Thu, 2010-03-18 at 11:47 +0100, Bernhard Schiffner wrote:
> > Hallo John,
> > 
> > almost a year ago was a little discussion in LinuxPPS about making the
> > /dev/pps* readable, returning a timestamp.
> > There was a patch (and still is) doing so but the thread stoped because
> > of other priorities.
> > (IIRC I sent you some private e-mail on this topic.)
> 
> So, not remembering here, what would this provide that clock_gettime()
> does not?
These timestamps are recorded when an interrupt is proceeded. The value stays 
until the next event occurs,  clock_gettime() increases.

ntpd (as the main pps consumer) adjusts clocks to fit such a timestamp to the 
systems full second as close as possible.

This is the most common use. But "irregular" events should be able to get (and 
report!) timestamps too.

> > A recent discussion showed that users want to have a "normal" read() and
> > something to use with select() in addition to the RFC2783 functionality.
> > 
> > http://ml.enneenne.com/pipermail/linuxpps/2010-March/003647.html
> > 
> > My question to you:
> > Do you know something how others (parts in the kernel, operating systems
> > ...) handle these problems?
> > (Format of timestamps, mechanisms to trigger select()  etc.)
> > 
> > Examples:
> > http://publib.boulder.ibm.com/infocenter/radhelp/v6r0m1/index.jsp?topic=/
> > com.ibm.etools.egl.doc/topics/reglasm0901.html doesn't mention the
> > ns-part (only -S / ms).
> > 
> > man date reveals the +%N format for nanoseconds
> > 
> > The recent patch adds the slope triggering the timestamp and a counter
> > for
> > 
> > each slope:
> >        assert 577917 1236209879.010016955
> >        
> >         clear 577917 1236209879.011017749
> 
> I'm not sure I'm following you from just the links above. I might need
> some additional context and background.

What do you think makes a timestamp a timestamp?
The answer LinuxPPS  implementing RFC2783 gives is:
1.) an incremental number,
2.) the slope,
3.) the reported time (with best available resolution, ns these days).

Rodolfo provides this by sysfs (linux-specific) already. Georges patch intends 
to do the same with the character device  /dev/pps* (more visible). But before 
you start an implementation, it is good practice to inform yourself about 
applicable standards and things others do .
IMHO there is noone else doing this. But I don't know exactly. This caused the 
question to you.

> > About a Plan9 inspired /dev/time (IIR not mainline yet)
> > http://lwn.net/Articles/323658/
> 
> Really, I think /dev/time is a bad idea. It duplicates a pre-existing
> interface, and just gives us one more thing to maintain without any
> clear benefit.
Me too.
(It was more about their proposed _format_. )
>
> thanks
> -john

Thanks for your fast response!


Bernhard



More information about the LinuxPPS mailing list