Commit 3198b90e authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

time: clarify Unix, UnixNano, and In a bit

Fixes #23316

Change-Id: Ia1758b406d369bbfaace0bdfea02cd6f40735b65
Reviewed-on: https://go-review.googlesource.com/120060Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent cdce8248
...@@ -1076,7 +1076,9 @@ func (t Time) Local() Time { ...@@ -1076,7 +1076,9 @@ func (t Time) Local() Time {
return t return t
} }
// In returns t with the location information set to loc. // In returns a copy of t representating the same time instant, but
// with the copy's location information set to loc for display
// purposes.
// //
// In panics if loc is nil. // In panics if loc is nil.
func (t Time) In(loc *Location) Time { func (t Time) In(loc *Location) Time {
...@@ -1104,7 +1106,8 @@ func (t Time) Zone() (name string, offset int) { ...@@ -1104,7 +1106,8 @@ func (t Time) Zone() (name string, offset int) {
} }
// Unix returns t as a Unix time, the number of seconds elapsed // Unix returns t as a Unix time, the number of seconds elapsed
// since January 1, 1970 UTC. // since January 1, 1970 UTC. The result does not depend on the
// location associated with t.
func (t Time) Unix() int64 { func (t Time) Unix() int64 {
return t.unixSec() return t.unixSec()
} }
...@@ -1113,7 +1116,8 @@ func (t Time) Unix() int64 { ...@@ -1113,7 +1116,8 @@ func (t Time) Unix() int64 {
// since January 1, 1970 UTC. The result is undefined if the Unix time // since January 1, 1970 UTC. The result is undefined if the Unix time
// in nanoseconds cannot be represented by an int64 (a date before the year // in nanoseconds cannot be represented by an int64 (a date before the year
// 1678 or after 2262). Note that this means the result of calling UnixNano // 1678 or after 2262). Note that this means the result of calling UnixNano
// on the zero Time is undefined. // on the zero Time is undefined. The result does not depend on the
// location associated with t.
func (t Time) UnixNano() int64 { func (t Time) UnixNano() int64 {
return (t.unixSec())*1e9 + int64(t.nsec()) return (t.unixSec())*1e9 + int64(t.nsec())
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment