Re: Duration

Marnen Laibow-Koser
Wed, 22 Dec 2010 17:09:22 -0000

Frederick Cheung wrote in post #970028:
> On Dec 22, 6:41am, Jack Waugh
<7aq3z2h...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> So far, so good.
>>
>> >> (y - x) / 1.second
>>
>> => Rational(28799745541, 28800000000)
>>
>> Since y is one day later than x, y - x should be a day. Dividing that
by 1
>> second should yield a pure number equal to the number of seconds in a
day.
>>
> The problem here is that y-x is a unitless number.

Well, then *there''s* the bad design decision.  DateTime - DateTime
should return a Duration, not a Fixnum.  Hmm.  Perhaps I''ll submit a
core patch for this.

 Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org

Sent from my iPhone

--
Posted via http://www.ruby-forum.com/.