Say something happens at a rate of 5000 per hour and there's some amount remaining (let's say 2500 for example's sake).
How would I get the hours, minutes, and seconds remaining?
I would think it'd be something along the lines of:
hour = floor(remaining / perHour)
mins = floor(remaining % perHour / 60)
secs = floor(remaining % perHour % 60)
However calculating that back up using the below returns the incorrect amount.
time = hour + (mins / 60) + (secs / 60 / 60)
time * perHour // 3472.2 - not 2500
The time should be shorter so I'm obviously calculating this wrong. I would appreciate it if someone were to explain where I went wrong.
EDIT: I'm aware this isn't the Maths SE but the Maths SE is supposed to be for high level maths, and this is the next best fit.
Figured out a method, but it may not be the best so I'll leave this question up for a while longer.
hour = floor(remaining / perHour)
mins = floor(remaining / perHour * 60) - hour * 60
secs = floor(remaining / perHour * 3600) - mins * 60 - hour * 3600