mirror of
https://github.com/golang/go
synced 2024-11-27 00:11:19 -07:00
time: correct unrepresentable Unix time comment
It's easy for someone who wants a time bigger than any valid time to reach for time.Unix(1<<63-1, 0), so it makes sense to explicit say such value is not valid. Fixes #10906 (again). Change-Id: If71e32472ae40d86c30e629b982406040a73c4c7 Reviewed-on: https://go-review.googlesource.com/10266 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
1e0760354c
commit
526b501713
@ -966,8 +966,8 @@ func (t *Time) UnmarshalText(data []byte) (err error) {
|
||||
// Unix returns the local Time corresponding to the given Unix time,
|
||||
// sec seconds and nsec nanoseconds since January 1, 1970 UTC.
|
||||
// It is valid to pass nsec outside the range [0, 999999999].
|
||||
// Not all sec values have a corresponding time value. Notable such
|
||||
// values are -1<<63 and 1<<63-1.
|
||||
// Not all sec values have a corresponding time value. One such
|
||||
// value is 1<<63-1 (the largest int64 value).
|
||||
func Unix(sec int64, nsec int64) Time {
|
||||
if nsec < 0 || nsec >= 1e9 {
|
||||
n := nsec / 1e9
|
||||
|
Loading…
Reference in New Issue
Block a user