Skip to content

Instantly share code, notes, and snippets.

Created October 23, 2014 15:36
What would you like to do?
Time elapsed in seconds
def secondsToStr(t):
This snippet converts the time elapsed in
seconds to HH:MM:SS.mmm
>>> secondsToStr(123456)
return "%d:%02d:%02d.%03d" % \
reduce(lambda x, y: divmod(x[0], y) + x[1:],
[(t*1000,), 1000, 60, 60])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment