Niklas Backlund wrote in message ...
>Hi,
>
>here I am with my small problems again! =)
>All the Time's that are created in Apr..Oct get an hour
>offset added! So in order to create midnight of, say,
>Sep 21, I have to write:
>
>irb(main):003:0> puts Time.local(2000, 9, 20, 23, 0)
>Thu Sep 21 00:00:00 GMT+1:00 2000
>
>Feature or bug?


This is the old clock forward/back problem that occurs whereever
people use Daylight Savings Time. If you were to set your system
clock to sometime in May thru September (my guess is that) you will
get different output.

I've seen this in Java as well, so I don't think it's a Ruby feature
or bug, it lives with the OS. What appears to be happening is that
the system is displaying the summer time differently than you are
setting it. Time.local() does not take a timezone, but displaying it
includes the timezone. Winter times are one hour back compared to
summer times, so when you display a summer time it adds 1 hour since
it is displaying it in the current winter mode.

Ideally the Summer times should be displayed with the Summer Timezone
and the Winter times with the winter timezone, as in

Wed Mar 01 00:00:00 MDT 2000
Sat Apr 01 00:00:00 MST 2000

but that is not happening in this case, all your times are being
displayed using winter time.

Overall I'd say that this behavior matches the least surprise
feature, since Time.local(2000, 5, 1, 0, 0) will occur at Midnight
local time on the 1st May, but when seen from November that time is
not an integral number of 24 hour units since the clocks are set back
one hour in October.

Pete
----
Pete McBreen, McBreen.Consulting , Cochrane, AB
email: petemcbreen / acm.org    http://www.mcbreen.ab.ca/
Software development is meant to be fun,
     if it isn't the process is wrong