-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Inconsistent end_of_day result #4989
Comments
Same issue here as well, reverting to 9.1.13 reports the correct date |
Where When either a
jruby-9.1.12.0 behaves as expected:
MRI 2.5.0 behaves as expected:
While I don't know the significance of this specific number, after briefly diving in more, it appears that Rational values somewhere north of
|
Still an issue as of today on jruby-9.1 HEAD. |
Ok, this is unlikely to be trivial, and it's not going to get fixed for 9.1.16.0. The general problem is lack of good support for Rational time components. In this case the very small Rational usec is getting rounded up to 1s, which pushes the date overnight. I have not dug into the code, but I'm almost certain we're turning the Rational into a 64-bit floating point value, so the resolution at which this happens would be along that boundary. The reason this won't be in 9.1.16.0 is because there's a lot of work involved in keeping usec (or really nsec) as a Rational if it came in as a Rational. On this timeframe, that's too big a risk. I suspect the eventual fix for this will be to turn the rational into a BigDecimal and store that internally, so we still have proper numeric operations but do not have to preserve all the Ruby semantics and overhead that go with a Rational object. |
Perhaps someone can try to bisect between 9.1.13 and 9.1.14 to see which commit(s) introduced this regression? It's probably going to be a fix for some other issue, but at least we'd have a narrower focus. |
Looks like this was introduced in 4be8d66b9e91e03e7f010b64a19c5290e7f651ec |
@mattbooks-square Of course it was 😢 |
@kares I don't suppose any work you've done might help this? I think you've mainly been messing with Date... |
nope, but I know why we regressed - that was an attempt to deal with a rounding issue, probably. |
fixes jruby#4989 ... follow-up on jruby#4866 (4be8d66)
resolved in jruby-9.1 with 682626e ... |
Environment
Expected Behavior
Time.now.end_of_day => 2018-01-18 23:59:59 +1100
Actual Behavior
jruby-9.1.15.0 > Time.now.end_of_day => 2018-01-19 00:00:00 +1100
The text was updated successfully, but these errors were encountered: