Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Getting back different values between Time#to_r and Time#to_i #3433
Sample test case:
In this example the rounding differences causes us to slip a day. We believe the problem is on this line: https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyTime.java#L747. By calling
Interestingly enough, fixing our to_r to return a proper Rational does not appear to fix it. Our construction of Time from Rational seems to still have a rounding issue:
Your script, expanded, with my to_r fix:
Continuing to investigate.