Skip to content

Commit

Permalink
Download time with empty minutes and seconds (#16)
Browse files Browse the repository at this point in the history
orig PR: nzbget/nzbget#800

Calculation of
Total time
Download time
Verification time
Repair time
Unpack time
was broken for python3. Everything except hours

def format_time_sec_orig(sec):
Hour = sec / 3600
Min = (sec - (sec / 3600) * 3600) / 60
Sec = (sec - (sec / 3600) * 3600) % 60
return '%d:%02d:%02d' % (Hour, Min, Sec)

def format_time_sec_new(sec):
Hour = sec / 3600
Min = (sec % 3600) / 60
Sec = (sec % 60)
return '%d:%02d:%02d' % (Hour, Min, Sec)

print("Orig: " + format_time_sec_orig(int(7199)))
print("New: " + format_time_sec_new(int(7199)))

Output:

1:00:00
1:59:59

Process finished with exit code 0
  • Loading branch information
ureyNZB authored Sep 15, 2023
1 parent 72a2214 commit 1be6f25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/EMail.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@
text += '\nAverage download speed: %.2f' % (avespeed) + unit

def format_time_sec(sec):
Hour = sec/3600
Min = (sec - (sec/3600)*3600)/60
Sec = (sec - (sec/3600)*3600)%60
Hour = sec / 3600
Min = (sec % 3600) / 60
Sec = (sec % 60)
return '%d:%02d:%02d' % (Hour,Min,Sec)

# add times
Expand Down

0 comments on commit 1be6f25

Please sign in to comment.