From 066ed44b04d3a91aa266480bcf8b46eb3a97d9ec Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 12 Apr 2003 10:39:04 +0000 Subject: [PATCH] Changed seen to use utils.timeElapsed. --- plugins/ChannelStats.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/plugins/ChannelStats.py b/plugins/ChannelStats.py index 3d6ee9d45..a882f8369 100644 --- a/plugins/ChannelStats.py +++ b/plugins/ChannelStats.py @@ -36,6 +36,7 @@ statistics about smileys, actions, characters, and words. Commands include: seen + stats """ from baseplugin import * @@ -46,6 +47,7 @@ import time import sqlite import debug +import utils import ircdb import ircmsgs import privmsgs @@ -241,20 +243,9 @@ class ChannelStats(callbacks.Privmsg, ChannelDBHandler): else: (seen, m) = cursor.fetchone() seen = int(seen) - ago = int(time.time()) - seen - days = ago / 86400 - ago %= 86400 - hours = ago / 3600 - ago %= 3600 - minutes = ago / 60 - seconds = ago % 60 - s = '%s day%s %s hour%s %s minute%s %s second%sago' % \ - (days, days == 1 and ',' or 's,', - hours, hours == 1 and ',' or 's,', - minutes, minutes == 1 and ',' or 's,', - seconds, seconds == 1 and ' ' or 's ') - irc.reply(msg, '%s was last seen here at %s saying %r' % \ - (name, s, m)) + s = '%s was last seen here %s ago saying %r' % \ + (name, utils.timeElapsed(time.time(), seen), m) + irc.reply(msg, s) def stats(self, irc, msg, args): "[] (if not sent in the channel itself) "