From 15dddcf1b7c52ffcd81b0b979118d4070cef9077 Mon Sep 17 00:00:00 2001 From: Jylpah Date: Sat, 15 Feb 2020 15:26:06 +0200 Subject: [PATCH] Class SlowBar: ETA estimate with minute accuracy --- blitzutils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/blitzutils.py b/blitzutils.py index 7484456..9245ed6 100644 --- a/blitzutils.py +++ b/blitzutils.py @@ -312,10 +312,15 @@ def bld_dict_hierarcy(d : dict, key : str, value) -> dict: ## ----------------------------------------------------------- class SlowBar(IncrementalBar): - suffix = '%(index)d/%(max)d %(percent)d%% ETA %(remaining_hours).1f hours' + suffix = '%(index)d/%(max)d %(percent)d%% ETA %(remaining_hours).0f h %(remaining_mins).0f mins' @property def remaining_hours(self): - return Decimal(self.eta / 3600).quantize(Decimal('1.0')) + return self.eta // 3600 + + @property + def remaining_mins(self): + return (self.eta - (self.eta // 3600)*3600) // 60 + ## -----------------------------------------------------------