Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
A Location maps time instants to the zone in use at that time. Typically, the Location represents the collection of time offsets in use in a geographical area. For many Locations the time offset varies depending on whether daylight savings time is in use at the time instant.
var UTC *Location = &utcLoc
UTC represents Universal Coordinated Time (UTC).
func FixedZone ¶
FixedZone returns a Location that always uses the given zone name and offset (seconds east of UTC).
func LoadLocation ¶
LoadLocation returns the Location with the given name.
If the name is "" or "UTC", LoadLocation returns UTC. If the name is "Local", LoadLocation returns Local.
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.
func LoadLocationFromTZData ¶
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 (*Location) FromLocalClock ¶ added in v0.133.0
FromLocalClock transposes the local timestamp from a time in the location to an equivalent clock time in UTC.
func (*Location) String ¶
String returns a descriptive name for the time zone information, corresponding to the name argument to LoadLocation or FixedZone.
func (*Location) ToLocalClock ¶ added in v0.133.0
ToLocalClock transposes the utc timestamp from a time in the UTC location to an equivalent clock time in the current location.