Просмотр исходного кода

check_ntp_time: Bug in average calculation fixed. Thanks to waja and Larsi

abrist 12 лет назад
Родитель
Сommit
ec8c777140
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      plugins/check_ntp.c

+ 3 - 1
plugins/check_ntp.c

@@ -54,7 +54,9 @@ void print_help (void);
 void print_usage (void);
 
 /* number of times to perform each request to get a good average. */
+#ifndef AVG_NUM
 #define AVG_NUM 4
+#endif
 
 /* max size of control message data */
 #define MAX_CM_SIZE 468
@@ -480,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;
 	}