From 88eb7b695ffd5bba6e22b228900e570aecf1eb6f Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 18 Aug 2018 21:54:12 +0100 Subject: show uptime in 1w1d1h1m1s format --- modules/stats.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'modules/stats.py') diff --git a/modules/stats.py b/modules/stats.py index 2f0953b5..09468327 100644 --- a/modules/stats.py +++ b/modules/stats.py @@ -1,4 +1,5 @@ import time +import Utils class Module(object): def __init__(self, bot): @@ -11,24 +12,8 @@ class Module(object): def uptime(self, event): seconds = int(time.time()-self.boot_time) - minutes = int(seconds/60) - if not minutes: - event["stdout"].write("Uptime: %s seconds" % seconds) - return - hours, minutes = int(minutes/60), int(minutes%60) - days, hours = int(hours/24), int(hours%24) - - days_str = "" - hours_str = "00" - minutes_str = "00" - if days: - days_str = "days " - if hours: - hours_str = str(hours).zfill(2) - if minutes: - minutes_str = str(minutes).zfill(2) - event["stdout"].write("Uptime: %s%s:%s" % (days_str, hours_str, - minutes_str)) + event["stdout"].write("Uptime: %s" % Utils.to_pretty_time( + seconds)) def stats(self, event): networks = len(self.bot.servers) -- cgit v1.3.1-10-gc9f91