xref: /freebsd/contrib/ntp/html/huffpuff.html (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
5<meta name="generator" content="HTML Tidy, see www.w3.org">
6<title>The Huff-n'-Puff Filter</title>
7<link href="scripts/style.css" type="text/css" rel="stylesheet">
8</head>
9<body>
10<h3>The Huff-n'-Puff Filter</h3>
11<p>Last update:
12  <!-- #BeginDate format:En2m -->10-Mar-2014  05:09<!-- #EndDate -->
13    UTC</p>
14<hr>
15<p>In scenarios where a considerable amount of data are  downloaded or uploaded using DSL or telephone modem lines, timekeeping quality can be seriously degraded. This occurs because the traffic volume, and thus the queuing delays, on the upload and download directions of transmission can be very different. In many cases the apparent time errors are so large as to exceed the step threshold and a step correction can occur during and after the data transfer.</p>
16<p>The huff-n'-puff filter is designed to correct the apparent time offset in these cases. It depends on knowledge of the propagation delay when no other traffic is present, such as during other than work hours. The filter remembers the minimum delay over the most recent interval measured usually in hours. Under conditions of large delay, the filter corrects the apparent offset using the sign of the offset and the difference between the apparent delay and minimum delay. The name of the filter reflects the negative (huff) and positive (puff) correction, which depends on the sign of the offset. The filter is activated by the <tt>tinker huffpuff</tt> command, as described in the <a href="miscopt.html">Miscellaneous Options</a> page.</p>
17<hr>
18<div align="center"><img src="pic/flt4.gif" alt="gif">
19<p>Figure 1. Huff-n'-Puff Wedge Scattergram</p>
20</div>
21<p>Figure 1 shows how the huff-n'-puff filter works. Recall from the <a href="filter.html">Clock Filter Algorithm</a> page that the wedge scattergram plots sample points (<em>x</em>, <em>y</em>) corresponding to the measured delay and  offset, and that the limb lines are at slope &plusmn;0.5. Note in the figure that the samples are clustered close to the  upper limb line, representing heavy traffic in the download direction.  The  apparent offset <i>y</i><sub>0</sub> is near zero at the minimum delay <i>x</i><sub>0</sub>, which  is near  0.1s. Thus,  for a point (<em>x</em>, <em>y</em>), the true offset is</p>
22<blockquote>
23  <p>  &theta; = <em>y</em> <font face="symbol">-</font> (<em>x </em><font face="symbol">- </font><i>x</i><sub>0</sub>) / 2 for <em>y</em> &gt; <i>y</i><sub>0</sub> at or near the upper limb line or<br>
24    &theta; = <em>y</em> <font face="symbol">+</font> (<em>x </em><font face="symbol">- </font><i>x</i><sub>0</sub>) / 2 for <em>y</em> &lt; <i>y</i><sub>0</sub> at or near the lower limb line.</p>
25</blockquote>
26<p>In either case  the associated delay is &delta; = <em>x</em>.</p>
27<p>In the interior of the wedge scattergram far from the limb lines, the corrections are less effective and can lead to significant errors if the area between the limb lines is  heavily populated.</p>
28<hr>
29<p><script type="text/javascript" language="javascript" src="scripts/footer.txt"></script></p>
30</body>
31</html>
32