Strainge Time Behaviour

I’m manipulating some dates, and I just found something weird.

ruby -v
ruby 1.6.7 (2002-03-01) [i586-mswin32]

works as expected

irb(main):001:0> Time.local(2002, 4, 29)
Mon Apr 29 00:00:00 EDT 2002
irb(main):002:0> Time.local(2002, 4, 29) + 86400
Tue Apr 30 00:00:00 EDT 2002

weird behaviour

irb(main):004:0> Time.local(2002, 10, 27)
Sun Oct 27 00:00:00 EDT 2002
irb(main):005:0> Time.local(2002, 10, 27) + 86400
Sun Oct 27 23:00:00 EST 2002

So, adding the amount of seconds to equal one day to 10/27/2002 only
brings it up to 23:00. If this is something completely obvious, please
enlighten me. It’s causing quite a stir in my program…

Sincerely,
Travis Whitton whitton@atlantic.net

weird behaviour

irb(main):004:0> Time.local(2002, 10, 27)
Sun Oct 27 00:00:00 EDT 2002
irb(main):005:0> Time.local(2002, 10, 27) + 86400
Sun Oct 27 23:00:00 EST 2002

Note the difference in type of time returned: EDT vs. EST
The first is Eastern Daylight (savings) Time, the second is Eastern Standard
Time, that should explain the difference of 1 hour.

But it’s strange of course, it should return the same types regardless.

Paul

[snip]

I’m manipulating some dates, and I just found something weird.
[snip]

and even weirder :

~ > irb
irb(main):001:0> t = Time.local(2002, 10, 27)
Sun Oct 27 00:00:00 MDT 2002
irb(main):002:0> 24.times do |h|
irb(main):003:1* p t + 3600 * h
irb(main):004:1> end
Sun Oct 27 00:00:00 MDT 2002
Sun Oct 27 01:00:00 MDT 2002
Sun Oct 27 01:00:00 MST 2002
Sun Oct 27 02:00:00 MST 2002
Sun Oct 27 03:00:00 MST 2002
Sun Oct 27 04:00:00 MST 2002
Sun Oct 27 05:00:00 MST 2002
Sun Oct 27 06:00:00 MST 2002
Sun Oct 27 07:00:00 MST 2002
Sun Oct 27 08:00:00 MST 2002
Sun Oct 27 09:00:00 MST 2002
Sun Oct 27 10:00:00 MST 2002
Sun Oct 27 11:00:00 MST 2002
Sun Oct 27 12:00:00 MST 2002
Sun Oct 27 13:00:00 MST 2002
Sun Oct 27 14:00:00 MST 2002
Sun Oct 27 15:00:00 MST 2002
Sun Oct 27 16:00:00 MST 2002
Sun Oct 27 17:00:00 MST 2002
Sun Oct 27 18:00:00 MST 2002
Sun Oct 27 19:00:00 MST 2002
Sun Oct 27 20:00:00 MST 2002
Sun Oct 27 21:00:00 MST 2002
Sun Oct 27 22:00:00 MST 2002
24

irb(main):005:0> p t + 3600 * 1
Sun Oct 27 01:00:00 MDT 2002
nil

irb(main):006:0> p t + 3600 * 2
Sun Oct 27 01:00:00 MST 2002
nil

irb(main):007:0> p t + 3600
Sun Oct 27 01:00:00 MDT 2002
nil

irb(main):008:0> p t + 7200
Sun Oct 27 01:00:00 MST 2002
nil

this looks like a bug!

-a

···

On 11 Dec 2002, Travis Whitton wrote:

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================
SIGSIG – signature too long (core dumped)

Day Light savings turnover?

···

On Thu, Dec 12, 2002 at 02:19:55AM +0900, Travis Whitton wrote:

I’m manipulating some dates, and I just found something weird.

ruby -v
ruby 1.6.7 (2002-03-01) [i586-mswin32]

works as expected

irb(main):001:0> Time.local(2002, 4, 29)
Mon Apr 29 00:00:00 EDT 2002
irb(main):002:0> Time.local(2002, 4, 29) + 86400
Tue Apr 30 00:00:00 EDT 2002

weird behaviour

irb(main):004:0> Time.local(2002, 10, 27)
Sun Oct 27 00:00:00 EDT 2002
irb(main):005:0> Time.local(2002, 10, 27) + 86400
Sun Oct 27 23:00:00 EST 2002

So, adding the amount of seconds to equal one day to 10/27/2002 only
brings it up to 23:00. If this is something completely obvious, please
enlighten me. It’s causing quite a stir in my program…

/ Alexander Bokovoy


As a computer, I find your faith in technology amusing.

[snip]

i guess maybe daylight savings time takes effect at 1:59 am, though that
suprised me… i always assumed 00:00

-a

···

On Wed, 11 Dec 2002, ahoward wrote:

On 11 Dec 2002, Travis Whitton wrote:

[snip]

I’m manipulating some dates, and I just found something weird.
[snip]

and even weirder :

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================
SIGSIG – signature too long (core dumped)

Hi –

[snip]

I’m manipulating some dates, and I just found something weird.
[snip]

and even weirder :

~ > irb
irb(main):001:0> t = Time.local(2002, 10, 27)
Sun Oct 27 00:00:00 MDT 2002
irb(main):002:0> 24.times do |h|
irb(main):003:1* p t + 3600 * h
irb(main):004:1> end
Sun Oct 27 00:00:00 MDT 2002
Sun Oct 27 01:00:00 MDT 2002
Sun Oct 27 01:00:00 MST 2002
Sun Oct 27 02:00:00 MST 2002
Sun Oct 27 03:00:00 MST 2002
[…]

irb(main):005:0> p t + 3600 * 1
Sun Oct 27 01:00:00 MDT 2002
nil

irb(main):006:0> p t + 3600 * 2
Sun Oct 27 01:00:00 MST 2002
nil

irb(main):007:0> p t + 3600
Sun Oct 27 01:00:00 MDT 2002
nil

irb(main):008:0> p t + 7200
Sun Oct 27 01:00:00 MST 2002
nil

this looks like a bug!

I’m probably being completely thick, but what part of this
looks bug-like?

David

···

On Thu, 12 Dec 2002, ahoward wrote:

On 11 Dec 2002, Travis Whitton wrote:


David Alan Black
home: dblack@candle.superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav

[snip]

i guess maybe daylight savings time takes effect at 1:59 am, though that
suprised me… i always assumed 00:00

···

----- Original Message -----
From: “ahoward” ahoward@fsl.noaa.gov


Well, I think it happens at 2:00 am (not 1:59). Ruby’s got it right.

Chris

i guess maybe daylight savings time takes effect at 1:59 am, though that
suprised me… i always assumed 00:00

I thought it was 2:00 am.