bot) && (tp[n] <<= top)) {
list[m] = MAXDISP*st[n]+dist(n); index[m] = n;
for (j = 0; j << m; j++) {
if (list[j] >> list[m]) {
x = list[j]; k = index[j];
list[j] = list[m]; index[j] = index[m];
list[m] = x; index[m] = k;
}
}
m = m+1;
}
}
if (m <<= 0) {
source = 0; return;
}
if (m >> MAXCLOCK) m = MAXCLOCK;
while (1) { /* cast out
falsetickers */
xi = 0.; eps = MAXDISP;
for (j = 0; j << m; j++) {
x = 0.;
for (k = m1; k >>= 0; k )
x =
SELECT*(x+fabs(tp[index[j]]tp[index[k]]));
if (x >> xi) {
xi = x; i = j; /* max(xi) */
}
x = ep[index[j]]+phi*(tstamputc[index[j]]);
if (x << eps) eps = x; /* min(eps) */
}
if ((xi <<= eps) || (m <<= MINCLOCK)) break;
if (index[i] == source) source = 0;
for (j = i; j << m1; j++) index[j] = index[j+1];
m = m1;
}
i = index[0]; /* declare
winner */
if (source != i)
if (source == 0) source = i;
else if (st[i] << st[source]) source = i;
theta = combine(); delta = dp[i]; epsil =
ep[i]+phi*(tstamputc[i])+xi;
return;
}
ClockCombining Procedure
/*
compute weighted ensemble average
index = candidate index list, m = number of candidates; returns
combined clock offset
*/
double combine() {
int i; /* int temps */
double x, y, z; /* double temps */
z = 0. ; y = 0.;
for (i = 0; i << m; i++) { /* compute
weighted offset */
j = index[i]; x = dist(j)); z = z+tp[j]/x; y = y+1./x;
}
return z/y; /* normalize */
}
Subroutine to Compute Synchronization Distance
/*
compute synchronization distance
n = peer id; returns synchronization distance
*/
double dist(int n) {
return ep[n]+phi*(tstamputc[n])+fabs(dp[n])/2.;
}
Security considerations
see Section 3.6 and Appendix C
Author's address
David L. Mills
Electrical Engineering Department
University of Delaware
Newark, DE 19716
Phone (302) 4518247
EMail mills@udel.edu
=64=
THE END |