Can Ruby do something like this?
irb(main):001:0> start = Time.now
=> Thu Nov 05 01:02:54 -0800 2009
irb(main):002:0> Time.now - start
=> 25.239
irb(main):003:0> (Time.now - start).duration
=> "25 seconds"
(the duration method doesn't exist now)... and similarly, report
23 minutes and 35 seconds
1 hour and 33 minutes
2 days and 3 hours
(either report the whole duration, up to how many seconds, or report up to 2 numbers and units (if day and hour is reported, then no need to tell how many minutes))
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…