I need to go from milliseconds to a tuple of (hour, minutes, seconds, milliseconds) representing the same amount of time. E.g.:
10799999ms = 2h 59m 59s 999ms
not really eleganter, but a bit shorter would be
function to_tuple(x): y = 60*60*1000 h = x/y m = (x-(h*y))/(y/60) s = (x-(h*y)-(m*(y/60)))/1000 mi = x-(h*y)-(m*(y/60))-(s*1000) return (h,m,s,mi)