Logan Capaldo
9/5/2006 11:52:00 PM
On Sep 5, 2006, at 6:36 PM, ara.t.howard@noaa.gov wrote:
> On Wed, 6 Sep 2006, Kevin Olbrich wrote:
>
>> FWIW,
>>
>> Rails already does this, as does Facets, the conversions gem, and the
>> ruby-units gem.
>>
>> The API varies a little bit.
>
> they do this?
>
> a = Time.now
> b = a + 42.seconds
>
> delta = b - a
>
> p delta.days #=> 0.000486111111111111
>
> i didn't know they handled time differences too? i'm sure rails
> does not do
> this and the docs for facets seems to show it does not. are you sure?
I'm not exactly sure what delta.days means in this case, but rails
does the following with your example:
% script/console
Loading development environment.
>> a = Time.now
=> Tue Sep 05 19:50:11 -0400 2006
>> b = a + 42.seconds
=> Tue Sep 05 19:50:53 -0400 2006
>> delta = b - a
=> 42.0
>> p delta.days
3628800.0
=> nil
> --
> what science finds to be nonexistent, we must accept as
> nonexistent; but what
> science merely does not find is a completely different matter... it
> is quite
> clear that there are many, many mysterious things.
> - h.h. the 14th dalai lama
>