Decoder: time allows extra precision (#710)

As discussed[1], this change allows times to provide precision beyond the
nanosecond (nine digits fractional part). Extra precision is truncated according
to the TOML specificiation.

[1]: https://github.com/pelletier/go-toml/discussions/707
This commit is contained in:
Thomas Pelletier
2021-12-26 17:05:10 +01:00
committed by GitHub
parent 177b4a5e53
commit 8ce5c3d78f
3 changed files with 31 additions and 14 deletions
+2 -1
View File
@@ -60,7 +60,8 @@ func (d *Decoder) SetStrict(strict bool) *Decoder {
//
// When a TOML local date, time, or date-time is decoded into a time.Time, its
// value is represented in time.Local timezone. Otherwise the approriate Local*
// structure is used.
// structure is used. For time values, precision up to the nanosecond is
// supported by truncating extra digits.
//
// Empty tables decoded in an interface{} create an empty initialized
// map[string]interface{}.