Go to the documentation of this file.
2 Module which allows timing to be performed.
15 """ A class for simple benchmark timing. """
22 """ Sets the end time of the timer. """
34 return time.strftime(
'%Y-%m-%d, %H:%M:%S', time.localtime(self.
end_time))
40 return time.strftime(
'%Y-%m-%d, %H:%M:%S', time.localtime(self.
start_time))
45 """ Sets the start time of the timer. """
52 """ Returns the elapsed time. """
62 """ Returns the elapsed time. """
81 (days, secs) = divmod(self.
total_time, SECS_PER_DAY)
82 (hours, secs) = divmod(secs, SECS_PER_HOUR)
83 (mins, secs) = divmod(secs, SECS_PER_MIN)
85 return '{0} {1:02d}:{2:02d}:{3:06.3f}'.format(
88 return '{0:02d}:{1:02d}:{2:06.3f}'.format(
int(hours),
91 return 'Timer started at {0} is still running.'.format(
92 time.strftime(
'%Y/%m/%d, %H:%M:%S',
98 """ Exception class for the BenchmarkTimer. """
102 return repr(self.
msg)
def get_end_time_str(self)
def get_start_time_str(self)
def get_total_time_str(self)