ntp: simplify get_poll_adj()
This commit is contained in:
parent
fa2c59d78d
commit
c2ab1426e5
1 changed files with 3 additions and 10 deletions
13
ntp_core.c
13
ntp_core.c
|
@ -728,19 +728,12 @@ static double
|
||||||
get_poll_adj(NCR_Instance inst, double error_in_estimate, double peer_distance)
|
get_poll_adj(NCR_Instance inst, double error_in_estimate, double peer_distance)
|
||||||
{
|
{
|
||||||
double poll_adj;
|
double poll_adj;
|
||||||
|
int samples;
|
||||||
|
|
||||||
if (error_in_estimate > peer_distance) {
|
if (error_in_estimate > peer_distance) {
|
||||||
int shift = 0;
|
poll_adj = -log(error_in_estimate / peer_distance) / log(2.0);
|
||||||
unsigned long temp = (int)(error_in_estimate / peer_distance);
|
|
||||||
do {
|
|
||||||
shift++;
|
|
||||||
temp>>=1;
|
|
||||||
} while (temp);
|
|
||||||
|
|
||||||
poll_adj = -shift - inst->poll_score + 0.5;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
int samples = SST_Samples(SRC_GetSourcestats(inst->source));
|
samples = SST_Samples(SRC_GetSourcestats(inst->source));
|
||||||
|
|
||||||
/* Adjust polling interval so that the number of sourcestats samples
|
/* Adjust polling interval so that the number of sourcestats samples
|
||||||
remains close to the target value */
|
remains close to the target value */
|
||||||
|
|
Loading…
Reference in a new issue