Skip to content

cleanup and improve Time's nsec rounding#4522

Merged
kares merged 7 commits intojruby:masterfrom
kares:test-time-cmp2
Mar 13, 2017
Merged

cleanup and improve Time's nsec rounding#4522
kares merged 7 commits intojruby:masterfrom
kares:test-time-cmp2

Conversation

@kares
Copy link
Member

@kares 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 7 commits March 5, 2017 10:03
resolves jruby#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
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Time#nsec rounding is happening at a place we don't want.

1 participant