Skip to content

Commit

Permalink
Use time.time() instead of time.clock()
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Jul 28, 2019
1 parent bbfc5ee commit e6feb02
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions aiml/Kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def bootstrap(self, brainFile = None, learnFiles = [], commands = [],
processing). Upon returning the current directory is moved back to
where it was before.
"""
start = time.clock()
start = time.time()
if brainFile:
self.loadBrain(brainFile)

Expand All @@ -156,7 +156,7 @@ def bootstrap(self, brainFile = None, learnFiles = [], commands = [],
os.chdir( prev )

if self._verboseMode:
print( "Kernel bootstrap completed in %.2f seconds" % (time.clock() - start) )
print( "Kernel bootstrap completed in %.2f seconds" % (time.time() - start) )

def verbose(self, isVerbose = True):
"""Enable/disable verbose output mode."""
Expand Down Expand Up @@ -190,19 +190,19 @@ def loadBrain(self, filename):
"""
if self._verboseMode: print( "Loading brain from %s..." % filename, end="" )
start = time.clock()
start = time.time()
self._brain.restore(filename)
if self._verboseMode:
end = time.clock() - start
end = time.time() - start
print( "done (%d categories in %.2f seconds)" % (self._brain.numTemplates(), end) )

def saveBrain(self, filename):
"""Dump the contents of the bot's brain to a file on disk."""
if self._verboseMode: print( "Saving brain to %s..." % filename, end="")
start = time.clock()
start = time.time()
self._brain.save(filename)
if self._verboseMode:
print( "done (%.2f seconds)" % (time.clock() - start) )
print( "done (%.2f seconds)" % (time.time() - start) )

def getPredicate(self, name, sessionID = _globalSessionID):
"""Retrieve the current value of the predicate 'name' from the
Expand Down Expand Up @@ -326,7 +326,7 @@ def learn(self, filename):
"""
for f in glob.glob(filename):
if self._verboseMode: print( "Loading %s..." % f, end="")
start = time.clock()
start = time.time()
# Load and parse the AIML file.
parser = create_parser()
handler = parser.getContentHandler()
Expand All @@ -341,7 +341,7 @@ def learn(self, filename):
self._brain.add(key,tem)
# Parsing was successful.
if self._verboseMode:
print( "done (%.2f seconds)" % (time.clock() - start) )
print( "done (%.2f seconds)" % (time.time() - start) )

def respond(self, input_, sessionID = _globalSessionID):
"""Return the Kernel's response to the input string."""
Expand Down

0 comments on commit e6feb02

Please sign in to comment.