Hi!

As I have been investigating the ways of NTPD to fiddle with time in the 
LINUX kernel I discovered that /usr/include/linux/timex.h (as supplied 
by the kernel) is not in sync with /usr/include/sys/timex.h (as supplied 
by glibc 2.7). Since it is the sys/timex.h which is the interface to 
NTPD and anyone else (it is actually a neat little interface if 
correctly supported).

The fluke is that glibc duplicates the timex.h but has not been updated 
since oh... Linux 2.2.0. The linux/timex.h is up to date with the NTP 
API as far as I can see (have not checked the details).

There are some links that may be handy:
http://bugs.gentoo.org/attachment.cgi?id=165913&action=view
http://sources.redhat.com/bugzilla/show_bug.cgi?id=9690
http://sourceware.org/ml/libc-alpha/2008-03/msg00076.html

However a small test-program:
#include <stdio.h>
//#include <sys/timex.h>
#include "timex.h"

int main()
{
        struct timex foo;
        adjtimex(&foo);
        printf("TAI Offset %i\n", foo.tai);
        return 0;
}

(Notice my quick and dirty hack to use a hacked variant of timex.h as if 
the patch was being applied, also notice that the .c part does not apply 
to the adjtimex() call but to the ntp_gettime() call which I am not 
using, so I do not require that patch for this purpose.)

This should be the kernels feeling of the TAI-UTC difference. I do not 
think it reflects that:
mag...@heaven:~/gcc/ntptest$ ./tai
TAI Offset -1553771440
mag...@heaven:~/gcc/ntptest$ ./tai
TAI Offset -263060400
mag...@heaven:~/gcc/ntptest$ ./tai
TAI Offset 238212176
mag...@heaven:~/gcc/ntptest$ ./tai
TAI Offset 658158672
mag...@heaven:~/gcc/ntptest$ ./tai
TAI Offset 1551639632

So I guess there is more to it than that patch alone.

If someone could run the above test-program on some *BSD box or whatever 
implementing the NTP API version 4 I would be interested in seeing what 
the result would be. It surely isn't the definitive test on the API, but 
seems to detect one (of possible several) flaws.

Cheers,
Magnus

_______________________________________________
time-nuts mailing list -- [email protected]
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Reply via email to