[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Time Diff Module

digidigo

1/17/2006 4:49:00 PM

4 Answers

Wilson Bilkovich

1/17/2006 4:58:00 PM

0

On 1/17/06, David Clements <digidigo@gmail.com> 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

Runt may have what you're looking for:
http://runt.ruby...

Tutorial:
http://runt.ruby...doc/files/doc/tutorial_te_rdoc.html


Jonathan Leighton

1/17/2006 5:02:00 PM

0

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

--
Jonathan Leighton
http://turnips... | http://jonathanlei... | http://digital-...



Ara.T.Howard

1/17/2006 9:27:00 PM

0

nospam@nospam

7/29/2008 9:37:00 PM

0

On Tue, 29 Jul 2008 08:52:54 -0700, john w <j<no>@yahoo.com> wrote:

>x-no-archive: NO.

ARCHIVED.


>On Tue, 29 Jul 2008 10:17:46 -0400, NOSPAM <nospam@nospam> wrote:
> ? 2008 John D Weatherly all rights reserved; no portion of this post
>may be used anywhere else without written permission of the author.
>>You claimed on July 28th:
>>
>>> But you, like your kissy kissy, the retard "ujb" change nicks DAILY!
>>>
>>> THAT's sick.
>>
>>I replied:
>>DAILY, you claim? Fine -- show the posts where we have changed our
>>monikers daily, short bus!
>> This should be fun.
>>
>>And I'll keep pestering you for as long as it takes to prove you're a
>>liar concerning this, as well.
>>
>>
>>It has also been 28 days since you made your claim to Mike
>>about the BoM.........
>
>and you were proven a liar there as well.
>
> Nope.
>
> I see you are not one for patience!
>
> I said that as time and $$ and energy permit, I will be acquiring
>more copies of the BOM of different copyrights.
>
> What is your hurry?
>
> I'm not in a hurry. Why are you in a hurry?
>
>>
>>
>>So come on, johnnie. SHOW THE POSTS where Sweet-Sweet and I 'change
>>nicks daily'!
>
> I didn't say today or yesterday.
>
> And I am in no hurry to dig back through my archives, just to have
>you explain, "Oh! THAT!"
>
> "Well, you see, I have 5 computers...' (or however many you LIED
>about owning), and I was using computer A from 8 til 9, then I used
>computer B from 9 til 10, then computer C from 10 - 1."
>
> You always have a story for after you're caught in a lie.
>
>
>
Your usual COWARDICE is duly noted, short bus.