From: Daniel Waite Date: 2007-12-03T05:58:29+09:00 Subject: Name this method... First off, if there's already a method that does this please point it out; I couldn't find one so I wrote my own. It's currently called #to_elapsed_time and is attached to Fixnum. What it does... >> 10.to_elapsed_time => {:days=>0, :minutes=>0, :seconds=>10, :hours=>0} >> 75.to_elapsed_time => {:days=>0, :minutes=>1, :seconds=>15, :hours=>0} >> 75018.to_elapsed_time => {:days=>0, :minutes=>50, :seconds=>18, :hours=>20} >> 789010.to_elapsed_time => {:days=>9, :minutes=>10, :seconds=>10, :hours=>3} The current name makes sense to me because I wrote it with this in mind: started = Time.now ended = Time.now + some_time_into_the_future elapsed = (ended.to_i - started.to_i).to_elapsed_time Looking at it now I suppose I could attach it to Time, too... time_1.elapsed(time_2) That would be kinda cool, too. What do you think? -- Posted via http://www.ruby-forum.com/.