[ntp:hackers] ntp_loopfilter.c bug?

Mark Martinec Mark.Martinec at ijs.si
Wed Apr 6 16:19:36 PDT 2005


Tonight's snapshot contains the following code section,
which has been modified recently. It looks suspiciously like a bug,
even without trying to understand what it does:

ntp_loopfilter.c near line 280:

	/*
         * Update the jitter estimate.
         */
	etemp = SQUARE(clock_jitter);
	dtemp = max(abs(fp_offset - last_offset),
	    LOGTOD(sys_precision));
	dtemp = SQUARE(fp_offset - last_offset);
	clock_jitter = SQRT(etemp + (SQUARE(dtemp) - etemp) /
	    CLOCK_AVG);

dtemp is computed, result discarded, and computed again.
A value is squared twice.

  Mark



More information about the hackers mailing list