On Mar 13, 2008, at 8:02 AM, Stefano Bortolotti wrote:

> I have tried this:
>>> t = Time.now
> => Thu Mar 13 12:57:47 +0100 2008
>>> t1 = Time.now + 1.hours
> => Thu Mar 13 13:58:03 +0100 2008
>>> t2 = t1 - t
> => 3615.968256
>>> tot = Time.at(t2)
> => Thu Jan 01 02:00:15 +0100 1970
>
> but I don't know why the difference between t1 e t is 2 hours and  
> not 1
> hour?


irb> t = Time.now
=> Thu Mar 13 09:26:37 -0400 2008
irb> t1 = Time.now + 3600
=> Thu Mar 13 10:26:56 -0400 2008
irb> t2 = t1 - t
=> 3618.385132
irb> Time.at(t2)
=> Wed Dec 31 20:00:18 -0500 1969

Because you're not looking at the time zone (+0100).

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com