mirror of
https://github.com/golang/go
synced 2024-11-23 07:00:05 -07:00
time: update docs to clarify goroutine-safety expectations of Time
Fixes #19935 Change-Id: I28e4cd6924f1b965a429a6a5ebfc4c0f952e8ae6 Reviewed-on: https://go-review.googlesource.com/40390 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
5dbdd79816
commit
4aa5d2eede
@ -81,8 +81,11 @@ import "errors"
|
||||
//
|
||||
// Programs using times should typically store and pass them as values,
|
||||
// not pointers. That is, time variables and struct fields should be of
|
||||
// type time.Time, not *time.Time. A Time value can be used by
|
||||
// multiple goroutines simultaneously.
|
||||
// type time.Time, not *time.Time.
|
||||
//
|
||||
// A Time value can be used by multiple goroutines simultaneously except
|
||||
// that the methods GobDecode, UnmarshalBinary, UnmarshalJSON and
|
||||
// UnmarshalText are not concurrency-safe.
|
||||
//
|
||||
// Time instants can be compared using the Before, After, and Equal methods.
|
||||
// The Sub method subtracts two instants, producing a Duration.
|
||||
|
Loading…
Reference in New Issue
Block a user