File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ def print_stats(self):
241
241
len (label ) for label in list (self .stages .keys ()) + [total_duration_label [:- 1 ]]
242
242
)) + 1 + 2
243
243
244
- table_width = max_label_length + 24
244
+ table_width = max_label_length + 23
245
245
divider = "-" * table_width
246
246
247
247
with StringIO () as output :
@@ -253,7 +253,7 @@ def print_stats(self):
253
253
file = output )
254
254
255
255
print (file = output )
256
- print (f"{ total_duration_label :<{max_label_length }} { total_duration :>12.2f } s " ,
256
+ print (f"{ total_duration_label :<{max_label_length }} { humantime ( total_duration ):>22 } " ,
257
257
file = output )
258
258
print (divider , file = output , end = "" )
259
259
LOGGER .info (f"Timer results\n { output .getvalue ()} " )
@@ -274,6 +274,21 @@ def change_cwd(dir: Path):
274
274
os .chdir (cwd )
275
275
276
276
277
+ def humantime (time_s : int ) -> str :
278
+ hours = time_s // 3600
279
+ time_s = time_s % 3600
280
+ minutes = time_s // 60
281
+ seconds = time_s % 60
282
+
283
+ result = ""
284
+ if hours > 0 :
285
+ result += f"{ int (hours )} h "
286
+ if minutes > 0 :
287
+ result += f"{ int (minutes )} m "
288
+ result += f"{ round (seconds )} s"
289
+ return result
290
+
291
+
277
292
def move_path (src : Path , dst : Path ):
278
293
LOGGER .info (f"Moving `{ src } ` to `{ dst } `" )
279
294
shutil .move (src , dst )
You can’t perform that action at this time.
0 commit comments