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

cleanup and improve Time's nsec rounding #4522

Merged
merged 7 commits into from Mar 13, 2017

Conversation

Projects
None yet
1 participant
@kares
Member

kares commented Mar 5, 2017

resolves #843

its still not the same as MRI (2.3.3) but it seems more correct e.g.

2.3.3 :006 > Time.utc(2013,6,30,14,56,14,263031.604).nsec
 => 263031603 
2.3.3 :007 > Time.utc(2013,6,30,14,56,14,263031.605).nsec
 => 263031604 

... while JRuby (after this change) :

irb(main):001:0> Time.utc(2013,6,30,14,56,14,263031.604).nsec
=> 263031604
irb(main):002:0> Time.utc(2013,6,30,14,56,14,263031.605).nsec
=> 263031605

irb(main):003:0> Time.utc(2013,6,30,14,56,14,263031.6053).nsec
=> 263031605
irb(main):004:0> Time.utc(2013,6,30,14,56,14,263031.6056).nsec
=> 263031606

kares added some commits Mar 5, 2017

fix: Time creation (utc/local) usec 'double' rounding to be intuitive
resolves #843

its still not the same as MRI (2.3.3) but it seems more correct e.g.

```
2.3.3 :006 > Time.utc(2013,6,30,14,56,14,263031.604).nsec
 => 263031603 
2.3.3 :007 > Time.utc(2013,6,30,14,56,14,263031.605).nsec
 => 263031604 
```

... while JRuby (after this change) :

```
irb(main):001:0> Time.utc(2013,6,30,14,56,14,263031.604).nsec
=> 263031604
irb(main):002:0> Time.utc(2013,6,30,14,56,14,263031.605).nsec
=> 263031605

irb(main):003:0> Time.utc(2013,6,30,14,56,14,263031.6053).nsec
=> 263031605
irb(main):004:0> Time.utc(2013,6,30,14,56,14,263031.6056).nsec
=> 263031606
```

@kares kares merged commit a22b6a3 into jruby:master Mar 13, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kares kares added this to the JRuby 9.1.9.0 milestone Mar 13, 2017

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