Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
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.