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

Change decimal length for result of time subtraction #4318

Closed
wants to merge 1 commit into from
Closed

Change decimal length for result of time subtraction #4318

wants to merge 1 commit into from

Conversation

maclover7
Copy link

This fixes an inconsistency between MRI and JRuby while trying to get
the Active Support test suite passing on JRuby.

This fixes an inconsistency between MRI and JRuby while trying to get
the Active Support test suite passing on JRuby.
@maclover7
Copy link
Author

cc @headius

@kares
Copy link
Member

kares commented Nov 18, 2016

there's a failing regression spec that needs to be considered :

     [exec] Failures:
     [exec] 
     [exec]   1) time minus precision handles BC time correctly
     [exec]      Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
     [exec] 
     [exec]        expected: -63504993600.0
     [exec]             got: -922337203.6854776
     [exec] 
     [exec]        (compared using ==)
     [exec]      # ./spec/regression/GH-652_time_add_spec.rb:14:in `block in (root)'

... maybe it just needs to be run under MRI 2.3 and confirm its a mis-behavior on JRuby's end

@kares
Copy link
Member

kares commented Jan 5, 2017

the (failing) regression spec: /spec/regression/GH-652_time_add_spec.rb runs fine on MRI 2.3.3

@kares
Copy link
Member

kares commented Jan 18, 2017

don't think this is worth a hustle since its good "enough" :

irb(main):001:0> time1 = Time.utc(2000, 1, 2, 23, 59, 59, Rational(999999999, 1000))
=> 2000-01-02 23:59:59 UTC
irb(main):002:0> time2 = Time.utc(2000, 1, 2, 0, 0, 0, Rational(1, 1000))
=> 2000-01-02 00:00:00 UTC
irb(main):003:0> time1 - time2
=> 86399.99999999799

... test can be adjusted to allow one 10^2 less precision to work, we shall worry if this is a real-world problem

@kares kares closed this Jan 18, 2017
@kares kares added this to the Invalid or Duplicate milestone Jan 18, 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.

None yet

2 participants