diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-05-02 05:22:31 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-05-02 05:22:31 +0000 |
commit | 3013b406f002aaefce9cda35c2486ab1ff2d3892 (patch) | |
tree | a7aa5b84cc32e743cf59240bb8a20ccd356d6d3c /plugins | |
parent | 14dd02c058bc34b7b47c31556b7cacaa4ea0942b (diff) | |
download | monitoring-plugins-3013b406f002aaefce9cda35c2486ab1ff2d3892.tar.gz |
Fix check_time returning wrong OK when time is before the epoch on some arch
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1703 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_time.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/check_time.c b/plugins/check_time.c index d3af3b0c..581c42a3 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -49,8 +49,8 @@ enum { #define UNIX_EPOCH 2208988800UL -uint32_t server_time, raw_server_time; -time_t diff_time; +uint32_t raw_server_time; +unsigned long server_time, diff_time; int warning_time = 0; int check_warning_time = FALSE; int critical_time = 0; @@ -166,9 +166,9 @@ main (int argc, char **argv) else diff_time = (unsigned long)end_time - server_time; - if (check_critical_diff == TRUE && diff_time > (time_t)critical_diff) + if (check_critical_diff == TRUE && diff_time > critical_diff) result = STATE_CRITICAL; - else if (check_warning_diff == TRUE && diff_time > (time_t)warning_diff) + else if (check_warning_diff == TRUE && diff_time > warning_diff) result = STATE_WARNING; printf (_("TIME %s - %lu second time difference|%s %s\n"), @@ -177,9 +177,9 @@ main (int argc, char **argv) check_warning_time, (long)warning_time, check_critical_time, (long)critical_time, TRUE, 0, FALSE, 0), - perfdata ("offset", (long)diff_time, "s", - check_warning_diff, (long)warning_diff, - check_critical_diff, (long)critical_diff, + perfdata ("offset", diff_time, "s", + check_warning_diff, warning_diff, + check_critical_diff, critical_diff, TRUE, 0, FALSE, 0)); return result; } |