Bug #3931

Timezone offset changing during addition

Added by Erik Bryn almost 5 years ago. Updated over 4 years ago.

[ruby-core:32750]
Status:Rejected
Priority:Normal
Assignee:-
ruby -v:1.9.2-p0 Backport:

Description

=begin
Here's the original code that I found this bug with:
ruby-1.9.2-p0 > t = Time.local(1900, nil, nil, nil, nil, nil)
=> 1900-01-01 00:00:00 -0800
ruby-1.9.2-p0 > t + 5_630_617_200
=> 2078-06-05 05:20:00 -0700

After looking into it further, it seems if I add >2816474399 to t, the timezone offset will change:
ruby-1.9.2-p0 > t + 2816474399
=> 1989-04-02 01:59:59 -0800
ruby-1.9.2-p0 > t + 2816474400
=> 1989-04-02 03:00:00 -0700
=end

History

#1 Updated by Nobuyoshi Nakada almost 5 years ago

  • Status changed from Open to Rejected

=begin
It's Daylight Saving Time.
=end

#2 Updated by Erik Bryn almost 5 years ago

=begin
Are you sure? This is new behavior in 1.9.2. I've tested with 1.8.7 & 1.9.1 and this doesn't occur.
=end

#3 Updated by Daniel Kelley almost 5 years ago

=begin
1989-04-02 is the first Sunday in April, which is the transition to daylight savings time in the US in that year.

I see your 1.9.2 behavior in my 1.8.7p72 and 1.9.1p243, so it doesn't look like a change in behavior to me.

=end

Also available in: Atom PDF