// registerLoadFromEmbeddedTZData is called by the time/tzdata package, // if it is imported. // //go:linkname registerLoadFromEmbeddedTZData func registerLoadFromEmbeddedTZData(f func(string) (string, error)) { … } var loadFromEmbeddedTZData … const maxFileSize … type fileSizeError … func (f fileSizeError) Error() string { … } const seekStart … const seekCurrent … const seekEnd … type dataIO … func (d *dataIO) read(n int) []byte { … } func (d *dataIO) big4() (n uint32, ok bool) { … } func (d *dataIO) big8() (n uint64, ok bool) { … } func (d *dataIO) byte() (n byte, ok bool) { … } // rest returns the rest of the data in the buffer. func (d *dataIO) rest() []byte { … } // Make a string by stopping at the first NUL func byteString(p []byte) string { … } var errBadData … // LoadLocationFromTZData returns a Location with the given name // initialized from the IANA Time Zone database-formatted data. // The data should be in the format of a standard IANA time zone file // (for example, the content of /etc/localtime on Unix systems). func LoadLocationFromTZData(name string, data []byte) (*Location, error) { … } func findZone(zones []zone, name string, offset int, isDST bool) int { … } // loadTzinfoFromDirOrZip returns the contents of the file with the given name // in dir. dir can either be an uncompressed zip file, or a directory. func loadTzinfoFromDirOrZip(dir, name string) ([]byte, error) { … } // get4 returns the little-endian 32-bit value in b. func get4(b []byte) int { … } // get2 returns the little-endian 16-bit value in b. func get2(b []byte) int { … } // loadTzinfoFromZip returns the contents of the file with the given name // in the given uncompressed zip file. func loadTzinfoFromZip(zipfile, name string) ([]byte, error) { … } var loadTzinfoFromTzdata … // loadTzinfo returns the time zone information of the time zone // with the given name, from a given source. A source may be a // timezone database directory, tzdata database file or an uncompressed // zip file, containing the contents of such a directory. func loadTzinfo(name string, source string) ([]byte, error) { … } // loadLocation returns the Location with the given name from one of // the specified sources. See loadTzinfo for a list of supported sources. // The first timezone data matching the given name that is successfully loaded // and parsed is returned as a Location. func loadLocation(name string, sources []string) (z *Location, firstErr error) { … } // readFile reads and returns the content of the named file. // It is a trivial implementation of os.ReadFile, reimplemented // here to avoid depending on io/ioutil or os. // It returns an error if name exceeds maxFileSize bytes. func readFile(name string) ([]byte, error) { … }