summaryrefslogtreecommitdiffstats
path: root/Core.py
diff options
context:
space:
mode:
Diffstat (limited to 'Core.py')
-rw-r--r--Core.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Core.py b/Core.py
index e44ce7584..20fb915c4 100644
--- a/Core.py
+++ b/Core.py
@@ -185,15 +185,23 @@ class Core(object):
return list
+ def format_time(self, seconds):
+ seconds = int(seconds)
+ if seconds > 60:
+ hours, seconds = divmod(seconds, 3600)
+ minutes, seconds = divmod(seconds, 60)
+ return "%.2i:%.2i:%.2i" % (hours, minutes, seconds)
+ return _("%i seconds") % seconds
+
def _test_print_status(self):
if self.thread_list.py_downloading:
for pyfile in self.thread_list.py_downloading:
if pyfile.status.type == 'downloading':
print pyfile.status.filename + ": speed is", int(pyfile.status.get_speed()), "kb/s"
- print pyfile.status.filename + ": finished in", int(pyfile.status.get_ETA()), "seconds"
+ print pyfile.status.filename + ": finished in", self.format_time(pyfile.status.get_ETA())
elif pyfile.status.type == 'waiting':
- print pyfile.status.filename + ": wait", int(pyfile.status.waituntil - time.time()), "seconds"
+ print pyfile.status.filename + ": wait", self.format_time(pyfile.status.waituntil - time.time())
def start(self):
""" starts the machine