Here is some interesting result with Rails 2.1 (without any specific
As you will see, adding 3.hours and then 21.hours doesn't give the same
result as adding 24.hours around DST change!
Loading development environment (Rails 2.1.0)
t = Time.parse("Sun Oct 26 00:30:00 +0200 2008")
I live in Switzerland, and DST change just happens at 02:00:00
t2 = t+3.hours
=> Sun Oct 26 02:30:00 +0100 2008
As you can see, the "missing" hour is taken into account, which is what
you would expect!
Now, let's add 21 more hours:
t2 = t2+21.hours
=> Sun Oct 26 23:30:00 +0100 2008
Which is right, too, since 24.hours have actually passed between the two
However, now just try the following:
=> Sun Oct 26 00:30:00 +0200 2008
t3 = t+24.hours
=> Mon Oct 27 00:30:00 +0100 2008
Huho! There is something wrong here!
Long story short:
Is there anything I am missing?