Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time zone conversion overflow #902

Closed
donv opened this issue Jul 23, 2013 · 9 comments
Closed

Time zone conversion overflow #902

donv opened this issue Jul 23, 2013 · 9 comments
Milestone

Comments

@donv
Copy link
Member

@donv donv commented Jul 23, 2013

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
Copy link
Member

@headius headius commented Jul 23, 2013

Weird one. Looking into it briefly.

@headius
Copy link
Member

@headius headius commented Jul 23, 2013

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
Copy link
Member

@headius headius commented Jul 23, 2013

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

@eregon
Copy link
Member

@eregon eregon commented Jul 23, 2013

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

@BanzaiMan
Copy link
Member

@BanzaiMan BanzaiMan commented Jul 24, 2013

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

@headius
Copy link
Member

@headius headius commented Jul 24, 2013

We'll call it fixed in 1.7.5 then.

@headius headius closed this Jul 24, 2013
@eregon
Copy link
Member

@eregon eregon commented Jul 24, 2013

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
Copy link
Member

@eregon eregon commented Jul 24, 2013

Confirmed, ffc93bf fixed it, thanks @tychobrailleur!

@tychobrailleur
Copy link
Contributor

@tychobrailleur tychobrailleur commented Jul 24, 2013

@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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants