Re: [chrony-dev] SW/HW timestamping on Linux

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Tue, Dec 06, 2016 at 10:00:40PM -0800, Denny Page wrote:
> Not sure what you meant here. The current code bases all its calculations of intervals base on the begin time of slot zero. Even if slot zero is bad, it’s total window is used in each time interval calculation. In the new code, a bad slot is never used in any way even if it is slot zero.

Yes, but that slot is just a reference to avoid loss of precision in
the calculation of the average. If its delay is large, it won't change
the result.

Let's say you have three samples (s_1, p_1, d_1), (s_2, p_2, d_2),
(s_3, p_3, d_3), and you want to calculate average of
o_i=(s_i + d_i/2 - p_i) using only the second and third sample.

The obvious way would be:

o = ((s_2 + d_2/2 - p_2) + (s_3 + d_3/2 - p_3)) / 2

But you can do it also like this

o = (s_1 + ((s_2 - s_1 + d_2/2) + (s_3 - s_1 + d_3/2)) / 2) -
    (p_1 + ((p_2 - p_1) + (p_3 - p_1)) / 2)

This simplifies to the first formula. The first sample is included in
the calculation, but it doesn't change the offset. It's there just to
keep floating-point values small.

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/