aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <none@none>2010-05-08 02:01:55 +0400
committerVsevolod Stakhov <none@none>2010-05-08 02:01:55 +0400
commit21550cd5e4fe1ff6058720db006ce417a3cb0068 (patch)
tree3a5c32b07f400b551fecb6d52b288d296ce3a8d3
parentb12da0a92ae2401ebdc57b427faf67627b2d770a (diff)
downloadrspamd-21550cd5e4fe1ff6058720db006ce417a3cb0068.tar.gz
rspamd-21550cd5e4fe1ff6058720db006ce417a3cb0068.zip
* Fix uptime command
-rw-r--r--src/controller.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/controller.c b/src/controller.c
index 875bedbcc..d3c5e9e70 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -451,8 +451,8 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
/* If uptime more than 2 hours, print as a number of days. */
if (uptime >= 2 * 3600) {
days = uptime / 86400;
- hours = uptime / 3600 - days * 3600;
- minutes = uptime / 60 - hours * 60 - days * 3600;
+ hours = uptime / 3600 - days * 24;
+ minutes = uptime / 60 - hours * 60 - days * 1440;
r = snprintf (out_buf, sizeof (out_buf), "%d day%s %d hour%s %d minute%s" CRLF, days, days > 1 ? "s" : " ", hours, hours > 1 ? "s" : " ", minutes, minutes > 1 ? "s" : " ");
}
/* If uptime is less than 1 minute print only seconds */
@@ -462,7 +462,7 @@ process_command (struct controller_command *cmd, char **cmd_args, struct control
/* Else print the minutes and seconds. */
else {
hours = uptime / 3600;
- minutes = uptime / 60 - hours * 3600;
+ minutes = uptime / 60 - hours * 60;
uptime -= hours * 3600 + minutes * 60;
r = snprintf (out_buf, sizeof (out_buf), "%d hour%s %d minite%s %d second%s" CRLF, hours, hours > 1 ? "s" : " ", minutes, minutes > 1 ? "s" : " ", (int)uptime, uptime > 1 ? "s" : " ");
}