Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Time zone conversion overflow #902

Closed
donv opened this Issue · 9 comments

5 participants

@donv
Collaborator

Hi!

I get a weird conversion error when converting from local time zone to utc for far future dates:

require 'active_support/core_ext'
Time.zone = 'Copenhagen'
Time.zone.parse('9999-12-31 23:59').to_s(:db)

Result:

JRuby 1.7.4: => "1816-03-30 04:55:08"
MRI 2.0.0p195 => "9999-12-31 22:59:00"

@headius
Owner

Weird one. Looking into it briefly.

@headius
Owner

On my system on JRuby master:

system ~/projects/jruby $ jirb
irb(main):001:0> require 'active_support/core_ext'
=> true
irb(main):002:0> Time.zone = 'Copenhagen'
=> "Copenhagen"
irb(main):003:0> Time.zone.parse('9999-12-31 23:59').to_s(:db)
=> "9999-12-31 22:59:00"

Can you confirm?

@headius
Owner

/cc @eregon since he's working on Time/Date stuff right now for GSoC.

@eregon
Collaborator

Works fine with jruby 1.6.7 (ruby-1.9.2-p312) at me, weird.

@BanzaiMan
Owner

Looks like a regression in 1.7.x, but it's fixed on master already.

@headius
Owner

We'll call it fixed in 1.7.5 then.

@headius headius closed this
@eregon
Collaborator

Mmh I look commits between now and jruby 1.7.4 and some like ffc93bf which could have fixed it.
The nanos-to-millis field is really a big source of bugs, I met a couple and created (and hopefully fixed) a couple others while working on time/date.

I wish to make DateTime millis always be 000 and nsec be nanos (everything under the second). It would avoid many useless/unreadable modulos and divisions. Could we change that or is it a big compat problem?

@eregon
Collaborator

Confirmed, ffc93bf fixed it, thanks @tychobrailleur!

@tychobrailleur
Collaborator

@eregon Yes, I think that was as part of the #652 fix. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.