Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SofaKing1337/ef8eea9df78832eb2c7c5bbb898e5d47 to your computer and use it in GitHub Desktop.
Save SofaKing1337/ef8eea9df78832eb2c7c5bbb898e5d47 to your computer and use it in GitHub Desktop.
import time
class SimpleTimer(object):
def __init__(self):
self.start_time = time.time()
def __enter__(self):
print "Timer start!"
def __exit__(self, exception_type, exception_value, traceback):
print "Execution time was {} seconds".format(time.time() - self.start_time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment