mirror of
https://github.com/golang/go
synced 2024-11-17 04:04:46 -07:00
time: add doc comment about tzdata package
Add doc comment about the time/tzdata package to the time.LoadLocation
function. The time.LoadLocation function was changed in Go 1.15 to add an extra
source that it considers for the time zone database. That location is the
time/tzdata package. It is not easy to discover this behavior because the
documentation for the time package doesn't mention it in the discussion on the
time.LoadLocation function when discussing the different sources. It would be helpful to
describe all possible sources that time.LoadLocation considers when loading the
time zone database, and so I think it would be worthwhile to mention
time/tzdata.
Change-Id: I408fbe188bf9d4ba797e59ec17eb677136d6a9c2
GitHub-Last-Rev: 3dac204326
GitHub-Pull-Request: golang/go#48673
Reviewed-on: https://go-review.googlesource.com/c/go/+/352830
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
bd8009d439
commit
6b0026ae31
@ -631,12 +631,13 @@ var zoneinfoOnce sync.Once
|
||||
// Otherwise, the name is taken to be a location name corresponding to a file
|
||||
// in the IANA Time Zone database, such as "America/New_York".
|
||||
//
|
||||
// The time zone database needed by LoadLocation may not be
|
||||
// present on all systems, especially non-Unix systems.
|
||||
// LoadLocation looks in the directory or uncompressed zip file
|
||||
// named by the ZONEINFO environment variable, if any, then looks in
|
||||
// known installation locations on Unix systems,
|
||||
// and finally looks in $GOROOT/lib/time/zoneinfo.zip.
|
||||
// LoadLocation looks for the IANA Time Zone database in the following
|
||||
// locations in order:
|
||||
//
|
||||
// - the directory or uncompressed zip file named by the ZONEINFO environment variable
|
||||
// - on a Unix system, the system standard installation location
|
||||
// - $GOROOT/lib/time/zoneinfo.zip
|
||||
// - the time/tzdata package, if it was imported
|
||||
func LoadLocation(name string) (*Location, error) {
|
||||
if name == "" || name == "UTC" {
|
||||
return UTC, nil
|
||||
|
Loading…
Reference in New Issue
Block a user