Re: Converting milliseconds to human time

2006-01-07 Thread Paul Rubin
Paul Rubin writes: > def dhms(m,t): >if not t: return (m,) >return rl(m//t[0], t[1:]) + (m % t[0],) Editing error, sigh. Meant of course to say >return dhms(m//t[0], t[1:]) + (m % t[0],) -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting milliseconds to human time

2006-01-07 Thread Paul Rubin
"Harlin Seritt" <[EMAIL PROTECTED]> writes: > I would like to take milliseconds and convert it to a more > human-readable format like: > > 4 days 20 hours 10 minutes 35 seconds # To iterate is human; to recurse, divine. def dhms(m,t): if not t: return (m,) return rl(m//t[0], t[1:]) + (m % t

Re: Converting milliseconds to human time

2006-01-07 Thread rurpy
"Max Erickson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > the hard way(in that you have to do it yourself): > > def prntime(ms): > s=ms/1000 > m,s=divmod(s,60) > h,m=divmod(m,60) > d,h=divmod(h,24) > return d,h,m,s Or abstracted... def decd (n, base): """ Decom

Re: Converting milliseconds to human time

2006-01-06 Thread Harlin Seritt
Thanks Dan, that would be perfect or close enough I should say. :-) Regards, Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting milliseconds to human time

2006-01-06 Thread Max Erickson
the hard way(in that you have to do it yourself): def prntime(ms): s=ms/1000 m,s=divmod(s,60) h,m=divmod(m,60) d,h=divmod(h,24) return d,h,m,s >>> print '%d days %d hours %d minutes %d seconds' % prntime(100) 0 days 0 hours 16 minutes 40 seconds >>> pri

Re: Converting milliseconds to human time

2006-01-06 Thread Dan Bishop
Harlin Seritt wrote: > I would like to take milliseconds and convert it to a more > human-readable format like: > > 4 days 20 hours 10 minutes 35 seconds > > Is there something in the time module that can do this? I havent been > able to find anything that would do it. The datetime module has some

Converting milliseconds to human time

2006-01-06 Thread Harlin Seritt
I would like to take milliseconds and convert it to a more human-readable format like: 4 days 20 hours 10 minutes 35 seconds Is there something in the time module that can do this? I havent been able to find anything that would do it. Thanks, Harlin Seritt -- http://mail.python.org/mailman/li