opae.admin: add time duration to progress output
Adds a "[Time:00:00:00.00]" output to the end of the progress string.
@@ -28,6 +28,7 @@ import codecs
import os
import sys
import time
+from datetime import timedelta
from opae.admin.utils.log import loggable
@@ -119,6 +120,9 @@ class progress(loggable):
if ratio is not None and len(ratio) == 2:
text += u' [{}/{} {}]'.format(ratio[0], ratio[1], self._units)
+ elapsed = timedelta(seconds=time.time() - self._start_time)
+ text += u'[Time:{}]'.format(elapsed)
+
if self._logfn is None and self._stream is None:
return text
