use time.strptime instead of parsing time ourselves
authorGeoffrey Thomas <geofft@mit.edu>
Sun, 1 Mar 2009 08:48:54 +0000 (03:48 -0500)
committerGeoffrey Thomas <geofft@mit.edu>
Sun, 1 Mar 2009 08:48:54 +0000 (03:48 -0500)
barn-growl/barn-growl.py

index c040de416c9955f93e61e3bb402fc3ef60ad7873..5a2bf4a22e818ac9a1f5db690775da0db7bffaf4 100755 (executable)
@@ -12,6 +12,7 @@ import select
 import sys
 from abstfilter import AbstractConsumer
 import optparse
+import time
 
 class Notifier(AbstractConsumer):
     def __init__(self, usegrowl, usenotify, useprint):
@@ -33,7 +34,7 @@ class Notifier(AbstractConsumer):
             zop = d['opcode'].lower()
             zsender = d['sender'].lower()
             zauth = d['auth'].lower() == 'yes'
-            ztime = ':'.join(d['time'].split(' ')[3].split(':')[0:2])
+            ztime = "%02d:%02d" % time.strptime(d['time'])[3:5]
             zmessage = d['message']
             idtuple = (zclass, zinstance, zsender, ztime)
             id = '%s/\n%s/\n%s\n %s' % idtuple