def elapsed(self):
"""
Returns the elapsed time (as a float) of the threaded execution which
includes the number of microseconds.
"""
if self._execution_begin is None:
# No elapsed time has taken place yet
return 0.0
if self._execution_finish is not None:
# Execution has completed, we only want to calculate
# the execution time.
elapsed_time = self._execution_finish - self._execution_begin
else:
# Calculate Elapsed Time
elapsed_time = datetime.utcnow() - self._execution_begin
elapsed_time = (elapsed_time.days * 86400) \
+ elapsed_time.seconds \
+ (elapsed_time.microseconds/1e6)
return elapsed_time
评论列表
文章目录