I have reported this to ruby-lang bugs a week ago (incoming #639),
but since it is yet to be analyzed, I am posting it here too:
March 30, 2003 has 25 hours!! There must be a problem with the
time representation try:
time = Time.local(2003, 3, 30) # => Sun Mar 30 00:00:00 EST 2003
time += 3600 # => Sun Mar 30 01:00:00 EST 2003
time += 3600 # => Sun Mar 30 02:00:00 EST 2003
time += 3600 # => Sun Mar 30 02:00:00 EST 2003 AGAIN !!!
time += 3600 # => Sun Mar 30 03:00:00 EST 2003
or
time = Time.local(2003, 3, 29) # => Sat Mar 29 00:00:00 EST 2003
time += 86400 # => Sun Mar 30 00:00:00 EST 2003 OK!
time += 86400 # => Sun Mar 30 23:00:00 EST 2003 WHAT???
Something wrong with the timezone localisation on your platform - I think it
should go from EST to EDT, and it should jump forwards an hour, not
backwards.
When I was at university in the late 80’s, we had a timesharing IBM
mainframe system. Every year in October it had to be shut down for an hour
when the clocks went back - because otherwise time would go backwards, files
would be deleted before they were created, and other temporal paradoxes
would arise.
Regards,
Brian.
···
On Thu, Mar 13, 2003 at 06:18:03PM +0900, Ricardo Nogueira wrote:
time = Time.local(2003, 3, 30) # => Sun Mar 30 00:00:00 EST 2003
time += 3600 # => Sun Mar 30 01:00:00 EST 2003
time += 3600 # => Sun Mar 30 02:00:00 EST 2003
time += 3600 # => Sun Mar 30 02:00:00 EST 2003 AGAIN !!!
time += 3600 # => Sun Mar 30 03:00:00 EST 2003
Bug me! I didn’t think of the daylight issue. And yes, Australia’s daylight saving time
ends on the last Sunday of March, thus the 25 hours day. I just don’t
understand why the change occurs between 2:00 and 3:00 am!
I have Gentoo Linux with local time on the Australia - Sydney timezone.
I run ruby 1.6.8.
Thanks a lot!
···
On Thu, 13 Mar 2003 18:29:36 +0900, Yukihiro Matsumoto wrote:
Tell us about your platform, Ruby version and your timezone.
I suspect it is related to the daylight saving time, and if my guess
is correct, that particular day has 25th hour.
Bug me! I didn’t think of the daylight issue. And yes, Australia’s daylight saving time
ends on the last Sunday of March, thus the 25 hours day. I just don’t
understand why the change occurs between 2:00 and 3:00 am!
That’s just how it’s defined to be. Presumably, it’s because everyone … other than programmers … are asleep at that time, and won’t notice it so much.