Skip to content

Commit 7d53ee3

Browse files
Flamefiresmoors
andauthored
Use divmod instead of manual divide and subtract
Co-authored-by: Sam Moors <[email protected]>
1 parent 30d29ba commit 7d53ee3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

easybuild/tools/utilities.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,8 @@ def time2str(delta):
302302

303303
delta_secs = delta.total_seconds()
304304

305-
hours = int(delta_secs / 3600)
306-
delta_secs -= hours * 3600
307-
mins = int(delta_secs / 60)
308-
secs = int(delta_secs - mins * 60)
305+
hours, remainder = divmod(delta_secs, 3600)
306+
mins, secs = divmod(remainder, 60)
309307

310308
res = []
311309
if hours:

0 commit comments

Comments
 (0)