[cvs-annodex] commit (/annodex): scripts/trunk/ircCMMLBot.py

conrad nobody at lists.annodex.net
Tue Apr 12 15:32:35 EST 2005


Update of /annodex (new revision 1242)

Modified files:
   scripts/trunk/ircCMMLBot.py

Log Message:
cmmlbot: use time.time() instead of time.clock() to use actual wallclock
time instead of CPU time ...


Modified: scripts/trunk/ircCMMLBot.py
===================================================================
--- scripts/trunk/ircCMMLBot.py	2005-04-12 04:50:42 UTC (rev 1241)
+++ scripts/trunk/ircCMMLBot.py	2005-04-12 05:32:35 UTC (rev 1242)
@@ -76,15 +76,15 @@
     """
     def __init__(self, file):
         self.file = file
-        self.start_time = time.clock()
-        #timestamp = self.gettimestamp()
+        self.start_time = time.time()
+        timestamp = self.gettimestamp()
 	self.file.write('<cmml>\n')
 	self.file.write('<stream timebase=\"%s\"/>\n' % timestamp)
 	self.got_head = False
 
     def gettimestamp(self):
         #timestamp = time.strftime("clock:%Y%m%dT%H%M%SZ", time.localtime(time.time()))
-        timestamp = time2npt(time.clock() - self.start_time)
+        timestamp = time2npt(time.time() - self.start_time)
 	return timestamp
 
     def head(self, topic):
@@ -221,9 +221,13 @@
 if __name__ == '__main__':
     # initialize logging
     log.startLogging(sys.stdout)
-    
+
     # create factory protocol and application
-    f = LogBotFactory(sys.argv[1], sys.argv[2])
+    try:
+        f = LogBotFactory(sys.argv[1], sys.argv[2])
+    except IndexError:
+        print 'Usage: cmmlbot channel filename'
+	sys.exit(1)
 
     # connect factory to this host and port
     reactor.connectTCP("irc.freenode.net", 6667, f)


-- 
conrad



More information about the cvs-annodex mailing list