Skip to content

Commit

Permalink
removing microseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
chmduquesne committed Aug 25, 2015
1 parent f55e140 commit 35a0ecd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions plugins/lag.py
Expand Up @@ -29,6 +29,11 @@ def __init__(self, bot):
self.data = {}


def timeformat(t):
"return a formatted time element without microseconds"
return str(t).split(".")[0]


def gc(self):
"Limit memory usage"
# don't watch more than 20 nicks
Expand Down Expand Up @@ -115,12 +120,12 @@ def cmd_lag(self, chan, args):
lag = self.lag(who)
if lag is not None:
self.say("Le %s-lag du moment est de %s." % (who,
str(lag)))
self.timeformat(lag)))
else:
previous_lag = self.data[who]["previous_lag"]
if previous_lag is not None:
self.say("Pas de lag pour %s (lag précédent: %s)." %
(who, str(previous_lag)))
(who, self.timeformat(previous_lag)))
else:
self.say("Pas de lag pour %s." % who)
else:
Expand All @@ -135,7 +140,7 @@ def cmd_mentions(self, chan, args):
for m in self.data[who]["mentions"]:
status = "✗" if m.pending else "✓"
time.sleep(0.5)
self.say("[%s] %s <%s> %s" % (status, str(m.timestamp),
m.author, m.msg))
self.say("[%s] %s <%s> %s" % (status,
self.timeformat(m.timestamp), m.author, m.msg))
else:
self.say("Pas d'infos sur %s." % who)

0 comments on commit 35a0ecd

Please sign in to comment.