[ntp:bk-ntp-dev-send] BitKeeper patch
Harlan Stenn
stenn at whimsy.udel.edu
Thu Jan 22 14:51:09 PST 2004
This BitKeeper patch contains the following changesets:
stenn at whimsy.udel.edu|ChangeSet|20040122224957|34873
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# ID: stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
# User: stenn
# Host: whimsy.udel.edu
# Root: /backroom/ntp-dev
#
#--- 1.167/ntpd/ntp_proto.c Fri Jan 2 16:01:41 2004
#+++ 1.168/ntpd/ntp_proto.c Thu Jan 22 17:49:28 2004
#@@ -1111,7 +1111,7 @@
# l_fp *recv_ts
# )
# {
#- l_fp t34, t21;
#+ double t34, t21;
# double p_offset, p_del, p_disp;
# double dtemp;
# l_fp p_rec, p_xmt, p_org, p_reftime;
#@@ -1222,20 +1222,36 @@
# poll_update(peer, 0);
#
# /*
#- * If running in a client/server association, calculate the
#- * clock offset c, roundtrip delay d and dispersion e. We use
#- * the equations (reordered from those in the spec). Note that,
#- * in a broadcast association, org has been set to the time of
#- * last reception. Note the computation of dispersion includes
#- * the system precision plus that due to the frequency error
#- * since the originate time.
#+ * For a client/server association, calculate the clock offset,
#+ * roundtrip delay and dispersion. The equations are reordered
#+ * from the spec for more efficient use of temporaries. For a
#+ * broadcast association, offset the last measurement by the
#+ * computed delay during the client/server volley. Note that
#+ * org has been set to the time of last reception. Note the
#+ * computation of dispersion includes the system precision plus
#+ * that due to the frequency error since the originate time.
#+ *
#+ * It is very important to respect the hazards of overflow. The
#+ * only permitted operation on raw timestamps is subtraction,
#+ * where the result is a signed quantity spanning from 68 years in
#+ * the past to 68 years in the future. To avoid loss of precision,
#+ * these calculations are done using 64-bit integer arithmetic.
#+ * However, the offset and delay calculations are sums and
#+ * differences of these first-order differences, which if done
#+ * using 64-bit integer arithmetic, would be valid over only half
#+ * that span. Since the typical first-order differences are
#+ * usually very small, they are converted to 64-bit doubles and
#+ * all remaining calculations done in floating-point arithmetic.
#+ * This preserves the accuracy while retaining the 68-year span.
# *
# * Let t1 = p_org, t2 = p_rec, t3 = p_xmt, t4 = peer->rec:
# */
#- t34 = p_xmt; /* t3 - t4 */
#- L_SUB(&t34, &peer->rec);
#- t21 = p_rec; /* t2 - t1 */
#- L_SUB(&t21, &p_org);
#+ ci = p_xmt; /* t3 - t4 */
#+ L_SUB(&ci, &peer->rec);
#+ LFPTOD(&ci, t34);
#+ ci = p_rec; /* t2 - t1 */
#+ L_SUB(&ci, &p_org);
#+ LFPTOD(&ci, t21);
# ci = peer->rec; /* t4 - t1 */
# L_SUB(&ci, &p_org);
# LFPTOD(&ci, p_disp);
#@@ -1250,27 +1266,22 @@
# * MODE_BCLIENT mode. The next broadcast message after that
# * computes the broadcast offset and clears FLAG_MCAST.
# */
#- ci = t34;
# if (pmode == MODE_BROADCAST) {
#+ p_offset = t34;
# if (peer->flags & FLAG_MCAST) {
#- LFPTOD(&ci, p_offset);
# peer->estbdelay = peer->offset - p_offset;
# if (peer->hmode == MODE_CLIENT)
# return;
#
# peer->flags &= ~FLAG_MCAST;
# }
#- DTOLFP(peer->estbdelay, &t34);
#- L_ADD(&ci, &t34);
#+ p_offset += peer->estbdelay;
# p_del = peer->delay;
# } else {
#- L_ADD(&ci, &t21); /* (t2 - t1) + (t3 - t4) */
#- L_RSHIFT(&ci);
#- L_SUB(&t21, &t34); /* (t2 - t1) - (t3 - t4) */
#- LFPTOD(&t21, p_del);
#+ p_offset = (t21 + t34) / 2.;
#+ p_del = t21 - t34;
# }
# p_del = max(p_del, LOGTOD(sys_precision));
#- LFPTOD(&ci, p_offset);
# if ((peer->rootdelay + p_del) / 2. + peer->rootdispersion +
# p_disp >= MAXDISPERSE) /* test 9 */
# peer->flash |= TEST9; /* bad root distance */
#
# Diff checksum=f0b32009
# Patch vers: 1.3
# Patch type: REGULAR
== ChangeSet ==
stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
stenn at whimsy.udel.edu|ChangeSet|20040122224513|34855
D 1.1213 04/01/22 17:49:57-05:00 stenn at whimsy.udel.edu +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Use doubles instead of NTP timestamps to work around the 34 year problem. From Dave Mills.
K 34873
P ChangeSet
------------------------------------------------
0a0
> stenn at whimsy.udel.edu|ntpd/ntp_proto.c|19990526004817|01635|3aed0663 stenn at whimsy.udel.edu|ntpd/ntp_proto.c|20040122224928|52638
== ntpd/ntp_proto.c ==
stenn at whimsy.udel.edu|ntpd/ntp_proto.c|19990526004817|01635|3aed0663
stenn at whimsy.udel.edu|ntpd/ntp_proto.c|20040102210141|45494
D 1.168 04/01/22 17:49:28-05:00 stenn at whimsy.udel.edu +32 -21
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Use doubles instead of NTP timestamps to work around the 34 year problem. From Dave Mills.
K 52638
O -rw-rw-r--
P ntpd/ntp_proto.c
------------------------------------------------
D1114 1
I1114 1
double t34, t21;
D1225 7
I1231 21
* For a client/server association, calculate the clock offset,
* roundtrip delay and dispersion. The equations are reordered
* from the spec for more efficient use of temporaries. For a
* broadcast association, offset the last measurement by the
* computed delay during the client/server volley. Note that
* org has been set to the time of last reception. Note the
* computation of dispersion includes the system precision plus
* that due to the frequency error since the originate time.
*
* It is very important to respect the hazards of overflow. The
* only permitted operation on raw timestamps is subtraction,
* where the result is a signed quantity spanning from 68 years in
* the past to 68 years in the future. To avoid loss of precision,
* these calculations are done using 64-bit integer arithmetic.
* However, the offset and delay calculations are sums and
* differences of these first-order differences, which if done
* using 64-bit integer arithmetic, would be valid over only half
* that span. Since the typical first-order differences are
* usually very small, they are converted to 64-bit doubles and
* all remaining calculations done in floating-point arithmetic.
* This preserves the accuracy while retaining the 68-year span.
D1235 4
I1238 6
ci = p_xmt; /* t3 - t4 */
L_SUB(&ci, &peer->rec);
LFPTOD(&ci, t34);
ci = p_rec; /* t2 - t1 */
L_SUB(&ci, &p_org);
LFPTOD(&ci, t21);
D1253 1
I1254 1
p_offset = t34;
D1256 1
D1263 2
I1264 1
p_offset += peer->estbdelay;
D1267 4
I1270 2
p_offset = (t21 + t34) / 2.;
p_del = t21 - t34;
D1273 1
# Patch checksum=fd4c5bf5
More information about the bk-ntp-dev-send
mailing list