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

DateTime.jd returns incorrect times with 9.2.0.0-SNAPSHOT #5092

Closed
philr opened this issue Mar 19, 2018 · 1 comment
Closed

DateTime.jd returns incorrect times with 9.2.0.0-SNAPSHOT #5092

philr opened this issue Mar 19, 2018 · 1 comment
Assignees
Milestone

Comments

@philr
Copy link
Contributor

philr commented Mar 19, 2018

Environment

  • jruby 9.2.0.0-SNAPSHOT (2.4.1) 2018-03-15 36b44df OpenJDK 64-Bit Server VM 25.151-b12 on 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12 +jit [linux-x86_64]
  • Linux linuxdev 4.13.0-37-generic #42-Ubuntu SMP Wed Mar 7 14:13:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Expected Behaviour

DateTime.jd should return a new DateTime when called with a Rational value. For example, with JRuby 9.1.16.0 and MRI 2.5.0:

$ jruby -rdate -e't=212388217200; 4.times {|n| puts DateTime.jd((t + n)/86400r) }'
2018-03-18T23:00:00+00:00
2018-03-18T23:00:01+00:00
2018-03-18T23:00:02+00:00
2018-03-18T23:00:03+00:00

The t value was calculated as:

86400 * DateTime.new(1970, 1, 1).jd + Time.utc(2018, 3, 18, 23).to_i

Actual Behaviour

DateTime.jd with the latest 9.2.0.0 snapshot build returns the wrong time when the seconds past the hour are non-zero:

$ jruby -rdate -e't=212388217200; 4.times {|n| puts DateTime.jd((t + n)/86400r) }'
2018-03-18T23:00:00+00:00
2018-03-18T23:00:24+00:00
2018-03-18T23:00:48+00:00
2018-03-18T23:01:12+00:00

It looks like something is causing the seconds past the hour to be multiplied by 24.

@kares kares self-assigned this Mar 19, 2018
@kares kares added this to the JRuby 9.2.0.0 milestone Mar 19, 2018
@kares
Copy link
Member

kares commented Mar 19, 2018

great - thanks. likely a regression due the recent date.rb rewrite ... #5076

@kares kares closed this as completed in 69364e2 Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants