[LinuxPPS] cross posting [time-nuts] NTP API on Linux 2.6.26

Michael Meier Michael.Meier at rrze.uni-erlangen.de
Sat Jan 10 22:51:25 CET 2009


>> You will also need to tell configure to use librt (./configure 
>> LIBS="-lrt") - without librt, ntpd will resort to using gettimeofday for 
>> getting time from the kernel, and that function only returns 
>> microseconds because it is defined that way.
> How is this on Fedora?

probably no different, unless they patched both kernel and glibc to 
death. Oh wait, they do that, but usually not in a good way...

> My ntpd shows the "nano" thing but do you imply that the accuracy 'under 
> water' could be different?

Possible, the nano thing doesn't really tell you much, except that it 
noticed that the kernel reported itself as a nanokernel.
When ntpd starts, it should print a message like
  precision = 1.000 usec
to your system log, right below the version string. The number it gives 
there is essentially the minimum difference between two subsequent calls 
to the gettime function in the kernel that it saw in 10 attempts or so. 
The 1.000 usec tells you that the kernel function it uses clearly does 
not support any better resolution, else it would be 1.001 oder 0.999 or 
something, the chances it hits the 1.000 by accident are just too slim. 
When I noticed this, I poked around a bit to find the reason. The reason 
is this: The configure script tries to find out if the function 
'clock_gettime' is available. It is on linux, but only when you link 
with librt, and ntpds configure does not see this, thus decides the 
function is NOT available. ntpd will then use the function 
'gettimeofday' as a replacement, but gettimeofday is defined to return 
usecs, not nsecs.
-- 
Michael Meier, HPC Services
Friedrich-Alexander-Universitaet Erlangen-Nuernberg
Regionales Rechenzentrum Erlangen
Martensstrasse 1, 91058 Erlangen, Germany
Tel.: +49 9131 85-28973, Fax: +49 9131 302941
michael.meier at rrze.uni-erlangen.de
www.rrze.uni-erlangen.de/hpc/



More information about the LinuxPPS mailing list