D
Daniel Waite
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...
=> {: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?
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...
=> {: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?