#17127: Better format for %timeit
-------------------------------+--------------------------
       Reporter:  jmantysalo   |        Owner:
           Type:  enhancement  |       Status:  needs_info
       Priority:  minor        |    Milestone:  sage-6.8
      Component:  interfaces   |   Resolution:
       Keywords:               |    Merged in:
        Authors:               |    Reviewers:
Report Upstream:  N/A          |  Work issues:
         Branch:               |       Commit:
   Dependencies:               |     Stopgaps:
-------------------------------+--------------------------

Comment (by jmantysalo):

 Here is one suggestion for timeit format:

 {{{
 def human_readable(t):
     if t <= 100:
         print t, "seconds"
         return
     d = t//(24*60*60)
     h = (t-d*24*60*60)//(60*60)
     m = t%(60*60)//60
     s = t%60
     o=""
     if d >= 2:
         o += str(d)+" days "
     if d == 1:
         o += "1 day "
     if h >= 2:
         o += str(h)+" hours "
     if h == 1:
         o += "1 hour "
     if m >= 2:
         o += str(m)+" minutes "
     if m == 1:
         o += "1 minute "
     if s >= 2:
         o += str(s)+" seconds "
     if s == 1:
         o += "1 second "
     o += "("+str(t)+" seconds)"
     print o
 }}}

 For sure there are smarter way to do this. But first, what is "right" way
 to show time here?

--
Ticket URL: <http://trac.sagemath.org/ticket/17127#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to