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

Michael Meier Michael.Meier at rrze.uni-erlangen.de
Sat Jan 10 16:00:39 CET 2009


> I think the following posting is of interest to us. 
> I remember someone patched timex.h to use nano precision with LinuxPPS.

Patching timex.h alone is not enough. You essentially have to patch and 
recompile glibc, else you will get uninitialized values from the .tai 
field, as the poster experienced, because glibc copies the fields and 
messes around instead of just passing the whole structure to the system 
call. Since I did not want to recompile glibc, I built a different 
workaround: I modified timex.h to contain static functions that replace 
the broken ones from glibc. You can get it from
  http://www.mulder.franken.de/blogfiles/timex.h
Note: You do not need to replace your systems timex.h with that - it is
enough to create a subdirectory include/sys in the NTP source tree and 
place it there before compilation.
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.
-- 
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