File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -125,10 +125,13 @@ def test_seconds():
125125 assert seconds ('1:30' ) == 90
126126 assert seconds ('1:1:30' ) == 3690
127127 assert seconds ('1:1:30.5' ) == 3690.5
128- def humantime (x , show_hour = False ):
128+ def humantime (x , show_hour = False , show_second = True ):
129129 hou = x // 3600
130130 min = (x % 3600 ) // 60
131131 sec = x % 60
132+ if not show_second :
133+ sec = round (sec / 60 )* 60
134+ return "%d:%02d" % (hou , min )
132135 if hou or show_hour :
133136 return "%d:%02d:%02d" % (hou , min , floor (sec ))
134137 return "%02d:%02d" % (min , floor (sec ))
@@ -224,7 +227,7 @@ def _emit(self, time=None):
224227 if time is not None :
225228 delta = f" ({ round ((time - self .lasttime )/ 60 ):>2d} min)"
226229 if self .enabled :
227- print (f"{ humantime (seconds (self .lasttime ) + self .delta ):>8s } { delta } { self .lasttitle } " )
230+ print (f"{ humantime (seconds (self .lasttime ) + self .delta , show_second = False ):>5s } { delta } { self .lasttitle } " )
228231 def __del__ (self ):
229232 self ._emit ()
230233
You can’t perform that action at this time.
0 commit comments