Fixed problems with cpustats on Windows; at least now an error is reported.

This commit is contained in:
Jeremy Fincher 2003-10-16 11:27:45 +00:00
parent c40f5e6c59
commit b6185c4b33
2 changed files with 7 additions and 2 deletions

View File

@ -164,7 +164,13 @@ class Status(callbacks.Privmsg):
Returns some interesting CPU-related statistics on the bot.
"""
(user, system, childUser, childSystem, elapsed) = os.times()
timeRunning = time.time() - world.startedAt
now = time.time()
timeRunning = now - world.startedAt
if user+system > timeRunning:
irc.error(msg, 'I seem to be running on a platform without an '
'accurate way of determining how long I\'ve been '
'running.')
return
activeThreads = threading.activeCount()
response = 'I have taken %s seconds of user time and %s seconds of '\
'system time, for a total of %s seconds of CPU time. My '\

View File

@ -45,7 +45,6 @@ class StatusTestCase(PluginTestCase, PluginDocumentation):
self.assertNotError('netstats')
def testCpustats(self):
self.assertNotError('cpustats')
try:
original = world.startedAt
world.startedAt = time.time()