Fixing bug in average calculation (Submitted by Lars)

The more important change: A fix for a bug which caused the check_ntp_time
and check_ntp_time check to always take the first response from ntp and not
the avarage since "j" is not increased anywhere. "i" should be used there
instead.

Partly Closes #956 and Closes #1166
Closes: #1089
This commit is contained in:
Jan Wagner 2014-01-24 18:20:08 +01:00
parent c5dc81cd28
commit ccecba33a2
2 changed files with 2 additions and 2 deletions

View file

@ -482,7 +482,7 @@ double offset_request(const char *host, int *status){
} else {
/* finally, calculate the average offset */
for(i=0; i<servers[best_index].num_responses;i++){
avg_offset+=servers[best_index].offset[j];
avg_offset+=servers[best_index].offset[i];
}
avg_offset/=servers[best_index].num_responses;
}

View file

@ -428,7 +428,7 @@ double offset_request(const char *host, int *status){
} else {
/* finally, calculate the average offset */
for(i=0; i<servers[best_index].num_responses;i++){
avg_offset+=servers[best_index].offset[j];
avg_offset+=servers[best_index].offset[i];
}
avg_offset/=servers[best_index].num_responses;
}