Last active
January 24, 2019 17:12
-
-
Save msuzen/4b3d3217b8087ea54f379027a23f1836 to your computer and use it in GitHub Desktop.
Matlab like tic toc functions in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To measure timing | |
#' http://stackoverflow.com/questions/5849800/tic-toc-functions-analog-in-python | |
def tic(): | |
# Homemade version of matlab tic and toc functions | |
import time | |
global startTime_for_tictoc | |
startTime_for_tictoc = time.time() | |
def toc(): | |
import time | |
if 'startTime_for_tictoc' in globals(): | |
print "Elapsed time is " + str(time.time() - startTime_for_tictoc) + " seconds." | |
else: | |
print "Toc: start time not set" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment