[ntp:questions] how to have offset < 1ms
unruh at wormhole.physics.ubc.ca
Fri Apr 16 14:04:57 UTC 2010
On 2010-04-16, Miroslav Lichvar <mlichvar at redhat.com> wrote:
> On Thu, Apr 15, 2010 at 03:44:21PM +0000, unruh wrote:
>> On 2010-04-15, Miroslav Lichvar <mlichvar at redhat.com> wrote:
>> > Userspace timestamps may decrease the accuracy by more than just 0.5
>> > us. When I compare kernel timestamps and timestamps from gpsd, there
>> > is a 20-40us difference, even when the gpsd process has real time
>> > priority and the machine is otherwise idle.
>> OK, I have wondered about this. Have you tried to control the
>> interrupts? Ie, run a program which times and puts out data on say one of
>> the parallel port lines and run that into the serial port interrupt line
>> so you can actually see the difference in time between the assertion of
>> the signal and the receipt of the signal by gpsd/serial port?
> No, I'm not sure how would I do that.
I rewrote the "short" module from Linux Device Drivers
to timestamp the output to the parallel pin and the input from the
interrupt service routing, and print the difference.
In the serial case you would print the output time to the pin and the
timestamp from the serial interrupt service routine.
> But I tried switching the PPS signal connection between parallel and
> serial port and compare offsets. The pulses from serial port were
> coming about 2.5-3 us later and jitter was same for both, about 1 us.
> It would be interesting to see if the parallel port latencies are
> better with the Alexander Gordeev's LinuxPPS parport client. It's able
> to capture clear events by polling, so there is no interrupt latency.
> Unfortunately I wasn't able to get it working as it requires assert to
> happen only few microseconds before clear.
Polling is surely worse than interrupt unless you are devoting the whole
computer to the polling.
More information about the questions