-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
It happens that people subtract times more than 292 years apart (usually because of use of the zero time), resulting in an incorrect Duration. The current subtraction does not check for overflow so the duration wraps and may be positive or negative but is certainly not correct. We can't return the correct answer, but we could help avoid surprises by clamping the result of Sub to -maxDuration or +maxDuration. This would apply to time.Since as well. Too late for Go 1.1. Probably do for Go 1.2.