-
Notifications
You must be signed in to change notification settings - Fork 18k
time: Time.Sub regression #33677
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
Comments
Change https://golang.org/cl/190497 mentions this issue: |
Change https://golang.org/cl/190524 mentions this issue: |
Change https://golang.org/cl/190524 mentions this issue: |
CL 131196 optimized Time.Sub, but was reverted because it incorrectly computed the nanoseconds in some edge cases. This CL adds a test case to enforce the correct behavior so that a future optimization does not break this again. Updates #17858 Updates #33677 Change-Id: I596d8302ca6bf721cf7ca11cc6f939639fcbdd43 Reviewed-on: https://go-review.googlesource.com/c/go/+/190524 Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This reverts commit CL 131196 because there is a bug in the calculation of nanoseconds. Fixes golang#33677 Change-Id: Ic8e94c547ee29b8aeda1b9a5cb9764dbf47b14b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/190497 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Andrew Bonventre <andybons@golang.org>
CL 131196 optimized Time.Sub, but was reverted because it incorrectly computed the nanoseconds in some edge cases. This CL adds a test case to enforce the correct behavior so that a future optimization does not break this again. Updates golang#17858 Updates golang#33677 Change-Id: I596d8302ca6bf721cf7ca11cc6f939639fcbdd43 Reviewed-on: https://go-review.googlesource.com/c/go/+/190524 Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Wanted to give a little update on this. (Apologies if this should be written elsewhere.) There is a fix for this that passes all tests by checking |
Consider the following:
On
go1.12
, this prints:On
go1.13beta1
, this prints:Notice how the nanoseconds are off? On 1.12, it is correctly
.795099414
, while on 1.13, it is incorrectly.854775807
. This regression causes the calculation of timeouts for network connections to go wonky in RPC implementations.The culprit for this regression is https://golang.org/cl/131196
\cc @pongad @ianlancetaylor @cybrcodr @paranoiacblack
The text was updated successfully, but these errors were encountered: