Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Make subtract and addition operators work with DateTime objects #5369
We recently discovered a few nasty bugs that affect DateTime calculations when the precision of time is high enough.
As a practical example, when subtracting values produced by
I traced the problem down to
While I was working with this bug, I also discovered another bug, which turned out to be related: namely when adding sub-millisecond precision value to
Both of the bugs are reproducible using provided specs.
@kares Thanks for your input. I agree, the rounding part is a subpar solution.
However, while using longs fixes the problem with addition, it's not enough to fix the problems with subtraction. For instance, within the provided spec, the result for
I'm not quite yet there to understand how and where to best deal with the problem though.
for the record, only the add part is to be considered a regression, the sub-tract doesn't work in 9.1 either:
... we do the calculation "right" in 9.2 ~ the same as in previous JRubies.
can not use the rounding as is since (as CI revealed) that introduces more problems, will try to port the