[comp.protocols.time.ntp] clock resolutions etc..

rayaprol@SNOOK.ECS.UMASS.EDU (Venu S Rayaprolu) (01/12/91)

I was going throught the man pages for adjtime(2) on DECStation 5000
and found that the resolution on MIPS is 3.906ms and that on VAX is
10ms. The man page also goes on saying that the ticks of 9ms or 11ms
are used depending on the adjustment to be made. This only makes sense
for a VAX machine. Could anyone tell me what the rate of adjustment is
for a MIPS machine? 

Thanks.

Venu S Rayaprolu.

maj@cl.cam.ac.uk (Martyn Johnson) (01/14/91)

Venu S Rayaprolu requests information about the modified clock ticks used 
by adjtime on Ultrix.

On the VAX, the manpage is wrong when it says that ticks of 9ms and 11ms 
are used.  The actual values are 9.960ms and 10.040ms if the amount to be 
adjusted is less than a second, and 9.600ms and 10.400ms if the amount is 
greater than a second.

On the MIPS, the values used are 3.891ms and 3.921ms for small 
adjustments and 3.756ms and 4.056 for large adjustments.

I am not convinced that adjustments less than a clock tick work at all - 
does anyone have evidence otherwise?

(These values were observed by sitting in a tight loop watching the clock 
tick on a MicroVAX II running Ultrix 3.0 and a DECstation 3100 running 
Ultrix 3.1C.  In principle the values are CPU dependent.)

Martyn Johnson
University of Cambridge Computer Lab

mogul@wrl.dec.com (Jeffrey Mogul) (01/15/91)

In article <9101112100.AA22695@snook.ecs.umass.edu> rayaprol@umvlsi.ecs.umass.edu writes:
>I was going throught the man pages for adjtime(2) on DECStation 5000
>and found that the resolution on MIPS is 3.906ms and that on VAX is
>10ms. The man page also goes on saying that the ticks of 9ms or 11ms
>are used depending on the adjustment to be made. This only makes sense
>for a VAX machine. Could anyone tell me what the rate of adjustment is
>for a MIPS machine? 

I think this part of the manual page is confused.  Basically, once per
clock interrupt the time variable is updated (ignoring roundoff error)

	if (TotalDelta != 0) {
		time += (1/HZ) + delta;
		TotalDelta -= delta;
	}
	else
		time += 1/HZ;

The adjtime(2) call sets TotalDelta to the amount of correction
that you ask for, and sets delta like this

	if (TotalDelta > bigadj)
		delta = 10 * tickadj;
	else
		delta = tickadj;

and then rounds TotalDelta to an exact multiple of delta.

So, the interesting parameters are the kernel globals bigadj
(defaults to 1 second) and tickadj to 4000/hz == 15 (for RISC)
or 1 (for Vax).  I really don't know why the RISC and Vax versions
are different; the consensus of the NTP community is that "1"
is the right value, but 15 seems to work pretty well.  (On older
Vax/Ultrix systems, tickadj seems to be 4000/hz == 40, as well.)

To answer your question, then:

System		Default increment	Fast increment  	Slow increment
RISC		 3906 uSec		 3921 uSec		 3891 uSec
VAX		10000 uSec		10001 uSec		 9999 uSec

assuming that the total adjustment requested is under 1 second (which
is always the case with ntpd).

-Jeff