Berger, Daniel
1/17/2006 6:38:00 PM
> -----Original Message-----
> From: Jonathan Leighton [mailto:lists@turnipspatch.com]
> Sent: Tuesday, January 17, 2006 10:02 AM
> To: ruby-talk ML
> Subject: Re: Time Diff Module
>
>
> On Wed, 2006-01-18 at 01:48 +0900, David Clements wrote:
> > Anyone know of a module out there that will encapsulate
> differences in
> > time?
> >
> > Ideally I would want something like this:
> >
> > d1 = DateTime.now + 2.hours + 2.minutes
> > d2 = DateTime.now
> >
> > diff = d1-d2
> >
> >
> > puts "Diff: #{diff.hours}:#{diff.minutes}"
> >
> >
> > >> Diff: 2:02
> >
> > I have searched for examples and all of them seem to be doing this
> > manually.
> >
> > Dave
>
> Ruby on Rails' ActiveSupport::CoreExtensions::Numeric::Time
> module supports this. The gem is activesupport. You might
> want to extract it somehow to avoid getting the rest of the
> library if you don't need it.
>
> Jon
This request seems common enough that I wonder if we could convince one
of the Rails folks to package that bit up separately so folks can
install without without having to install ActiveSupport.
Regards,
Dan