...
Source file
src/time/zoneinfo_unix.go
Documentation: time
1
2
3
4
5
6
7
8
9
10
11
12 package time
13
14 import (
15 "runtime"
16 "syscall"
17 )
18
19
20
21 var zoneSources = []string{
22 "/usr/share/zoneinfo/",
23 "/usr/share/lib/zoneinfo/",
24 "/usr/lib/locale/TZ/",
25 runtime.GOROOT() + "/lib/time/zoneinfo.zip",
26 }
27
28 func initLocal() {
29
30
31
32
33
34 tz, ok := syscall.Getenv("TZ")
35 switch {
36 case !ok:
37 z, err := loadLocation("localtime", []string{"/etc/"})
38 if err == nil {
39 localLoc = *z
40 localLoc.name = "Local"
41 return
42 }
43 case tz != "" && tz != "UTC":
44 if z, err := loadLocation(tz, zoneSources); err == nil {
45 localLoc = *z
46 return
47 }
48 }
49
50
51 localLoc.name = "UTC"
52 }
53
View as plain text