I have timestamps that are calculated by a given interval. Ex: timestamp being 193894
and interval being 20000
. The time is calculated by doing 193894/20000 = 9.6947
. 9.6947
being 9 minutes
and 0.6947
of a minute in seconds (0.6947 * 60) = 42 s (rounded up)
thus the human readable timestamp being 9 min 42 sec
.
Is there a Pythonic (assuming there is some library) way of doing this rather than doing a silly math calculation like this for every timestamp?
The reason being is because if timestamp is 1392338
(1 hour 9 min 37 sec
) something that yields in the hours range, I want to be able to keep it dynamic.
I am just wondering if there was a better way to do this than the mathematical calculation way.