Currently, the math helpers for LocalTime (e.g. addHours) convert all of the values into milliseconds, then apply the change consistently in milliseconds. This means that addHours(1000) will probably overflow and produce an incorrect result.
Why do you want to add 1000 hours to a time-of-day? I have no idea, but there's no reason we should give back the wrong answer. We should switch to our int division function that returns both quotient and remainder, so that we can apply all of the full hours first, followed by the minute remainders, etc.
Currently, the math helpers for
LocalTime
(e.g.addHours
) convert all of the values into milliseconds, then apply the change consistently in milliseconds. This means thataddHours(1000)
will probably overflow and produce an incorrect result.Why do you want to add 1000 hours to a time-of-day? I have no idea, but there's no reason we should give back the wrong answer. We should switch to our int division function that returns both quotient and remainder, so that we can apply all of the full hours first, followed by the minute remainders, etc.