diff options
Diffstat (limited to 'plugins/check_ntp_time.c')
-rw-r--r-- | plugins/check_ntp_time.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 295f86f6..46cc604f 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c | |||
@@ -81,7 +81,7 @@ typedef struct { | |||
81 | /* this structure holds data about results from querying offset from a peer */ | 81 | /* this structure holds data about results from querying offset from a peer */ |
82 | typedef struct { | 82 | typedef struct { |
83 | time_t waiting; /* ts set when we started waiting for a response */ | 83 | time_t waiting; /* ts set when we started waiting for a response */ |
84 | int num_responses; /* number of successfully recieved responses */ | 84 | int num_responses; /* number of successfully received responses */ |
85 | uint8_t stratum; /* copied verbatim from the ntp_message */ | 85 | uint8_t stratum; /* copied verbatim from the ntp_message */ |
86 | double rtdelay; /* converted from the ntp_message */ | 86 | double rtdelay; /* converted from the ntp_message */ |
87 | double rtdisp; /* converted from the ntp_message */ | 87 | double rtdisp; /* converted from the ntp_message */ |
@@ -244,7 +244,7 @@ void setup_request(ntp_message *p){ | |||
244 | * this is done by filtering servers based on stratum, dispersion, and | 244 | * this is done by filtering servers based on stratum, dispersion, and |
245 | * finally round-trip delay. */ | 245 | * finally round-trip delay. */ |
246 | int best_offset_server(const ntp_server_results *slist, int nservers){ | 246 | int best_offset_server(const ntp_server_results *slist, int nservers){ |
247 | int i=0, cserver=0, best_server=-1; | 247 | int cserver=0, best_server=-1; |
248 | 248 | ||
249 | /* for each server */ | 249 | /* for each server */ |
250 | for(cserver=0; cserver<nservers; cserver++){ | 250 | for(cserver=0; cserver<nservers; cserver++){ |
@@ -303,7 +303,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){ | |||
303 | * we have to do it in a way that our lazy macros don't handle currently :( */ | 303 | * we have to do it in a way that our lazy macros don't handle currently :( */ |
304 | double offset_request(const char *host, int *status){ | 304 | double offset_request(const char *host, int *status){ |
305 | int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0; | 305 | int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0; |
306 | int servers_completed=0, one_written=0, one_read=0, servers_readable=0, best_index=-1; | 306 | int servers_completed=0, one_read=0, servers_readable=0, best_index=-1; |
307 | time_t now_time=0, start_ts=0; | 307 | time_t now_time=0, start_ts=0; |
308 | ntp_message *req=NULL; | 308 | ntp_message *req=NULL; |
309 | double avg_offset=0.; | 309 | double avg_offset=0.; |
@@ -368,7 +368,6 @@ double offset_request(const char *host, int *status){ | |||
368 | * been touched in the past second or so and is still lacking | 368 | * been touched in the past second or so and is still lacking |
369 | * some responses. For each of these servers, send a new request, | 369 | * some responses. For each of these servers, send a new request, |
370 | * and update the "waiting" timestamp with the current time. */ | 370 | * and update the "waiting" timestamp with the current time. */ |
371 | one_written=0; | ||
372 | now_time=time(NULL); | 371 | now_time=time(NULL); |
373 | 372 | ||
374 | for(i=0; i<num_hosts; i++){ | 373 | for(i=0; i<num_hosts; i++){ |
@@ -378,7 +377,6 @@ double offset_request(const char *host, int *status){ | |||
378 | setup_request(&req[i]); | 377 | setup_request(&req[i]); |
379 | write(socklist[i], &req[i], sizeof(ntp_message)); | 378 | write(socklist[i], &req[i], sizeof(ntp_message)); |
380 | servers[i].waiting=now_time; | 379 | servers[i].waiting=now_time; |
381 | one_written=1; | ||
382 | break; | 380 | break; |
383 | } | 381 | } |
384 | } | 382 | } |
@@ -635,7 +633,7 @@ void print_help(void){ | |||
635 | printf("%s\n", _("Notes:")); | 633 | printf("%s\n", _("Notes:")); |
636 | printf(" %s\n", _("If you'd rather want to monitor an NTP server, please use")); | 634 | printf(" %s\n", _("If you'd rather want to monitor an NTP server, please use")); |
637 | printf(" %s\n", _("check_ntp_peer.")); | 635 | printf(" %s\n", _("check_ntp_peer.")); |
638 | printf(" %s\n", _("--time-offset is usefull for compensating for servers with known")); | 636 | printf(" %s\n", _("--time-offset is useful for compensating for servers with known")); |
639 | printf(" %s\n", _("and expected clock skew.")); | 637 | printf(" %s\n", _("and expected clock skew.")); |
640 | printf("\n"); | 638 | printf("\n"); |
641 | printf(UT_THRESHOLDS_NOTES); | 639 | printf(UT_THRESHOLDS_NOTES); |