[ntp:questions] Re: ntpd transmit timestamp precision

David L. Mills mills at udel.edu
Fri Feb 17 02:21:44 UTC 2006


Harlan,

The NTP get_systime() routine calls one of three library routines, 
clock_gettime(), getimeofday() and getclock(), depending on 
autoconfigure. At least the first two and probably the last are kernel 
system calls and don't depend on other routines. The clock_gettime() and 
getclock() return nanoseconds in a timespec structure; the 
gettimeofday() returns microseconds in a timeval structure. As these are 
system calls, no matter what library they are in, they would operate the 
same way. I have no documentation on getclock(), either in Solaris or 
FreeBSD.

The fuzz is used only with gettimeofday() and yields about 12 bits of 
the 32-bit fraction field. As there are about four NTP ticks in a 
nanosecond, it is not productive to roll the random number generator to 
yield only two bits.

Dave

Harlan Stenn wrote:

> Dave,
> 
> I see to points Damion has raised where I do not see your response.
> 
> The first is that there exist several libraries where the C library provides
> the nano calls but implements them using the (older) microsecond
> calls. Therefore there is no data available below the microsecond and our
> code is not handling this case.
> 
> The second point was related to this one, but it escapes me at the moment.
> 
> Damion, what does clock_getres() return on these systems?
> 
> I need to finish packing for a trip - more later.
> 
> H
> --
> 
>>>>In article <dt1rgb$8co$1 at dewey.udel.edu>, "David L. Mills" <mills at udel.edu> writes:
> 
> 
> David> Damion, The ONLY function of the random fuzz is to fill the timestamp
> David> bits below the microsecond, and this ONLY with the kernel syscall
> David> that returns time in microseconds. Do NOT interpret the agenda in any
> David> other way.




More information about the questions mailing list