]> Cypherpunks repositories - gostls13.git/commit
time: correctly parse large input durations and avoid precision loss
authorMartin Möhrmann <martisch@uos.de>
Wed, 7 Jan 2015 18:56:06 +0000 (19:56 +0100)
committerRobert Griesemer <gri@golang.org>
Thu, 15 Jan 2015 00:15:58 +0000 (00:15 +0000)
commitd1210acffd19482a0471f68d62baf10695fee8b9
tree745f4c7b2010764fba640d69299df8c173639387
parent3b63b69d2f16be676d4fdc4f4ac697ed92abf523
time: correctly parse large input durations and avoid precision loss

Do not lose precision for durations specified without fractions
that can be represented by an int64 such as 1<<53+1 nanoseconds.
Previously there was some precision lost in floating point conversion.

Handle overflow for durations above 1<<63-1 nanoseconds but not earlier.

Add tests to cover the above cases.

Change-Id: I4bcda93cee1673e501ecb6a9eef3914ee29aecd2
Reviewed-on: https://go-review.googlesource.com/2461
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/time/format.go
src/time/time_test.go