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 doesn't set sec_fraction with 9.2.0.0-SNAPSHOT #5110

Closed
philr opened this Issue Mar 25, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@philr
Contributor

philr commented Mar 25, 2018

This is probably a regression from the recent date.rb rewrite #5076.

Environment

  • jruby 9.2.0.0-SNAPSHOT (2.4.1) 2018-03-25 b0f7aaf 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 set the sec_fraction of the instantiated DateTime. For example, with JRuby 9.1.16.0:

$ jruby -rdate -e'jd=2123888220001/864000r; d=DateTime.jd(jd); puts d; puts d.sec_fraction'
2018-03-25T23:00:00+00:00
1/10

The jd value was calculated as:

(86400 * DateTime.new(1970, 1, 1).jd + Time.utc(2018, 3, 25, 23).to_i)/86400r + 1/864000r

Actual Behaviour

The current version of DateTime.jd on master discards the fractional part of the second, leaving sec_fraction set to 0:

$ jruby -rdate -e'jd=2123888220001/864000r; d=DateTime.jd(jd); puts d; puts d.sec_fraction'
2018-03-25T23:00:00+00:00
0/1

@kares kares self-assigned this Mar 26, 2018

@kares kares added this to the JRuby 9.2.0.0 milestone Mar 26, 2018

@kares kares closed this in 25cc7a0 Mar 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment