1
// Copyright 2013 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
10
// go run genzabbrs.go | gofmt > $GOROOT/src/pkg/time/zoneinfo_abbrs_windows.go
26
// getAbbrs finds timezone abbreviations (standard and daylight saving time)
28
func getAbbrs(l *time.Location) (st, dt string) {
29
t := time.Date(time.Now().Year(), 0, 0, 0, 0, 0, 0, l)
30
abbr1, off1 := t.Zone()
31
for i := 0; i < 12; i++ {
32
t = t.AddDate(0, 1, 0)
33
abbr2, off2 := t.Zone()
35
if off2-off1 < 0 { // southern hemisphere
36
abbr1, abbr2 = abbr2, abbr1
53
func (zs zones) Len() int { return len(zs) }
54
func (zs zones) Swap(i, j int) { zs[i], zs[j] = zs[j], zs[i] }
55
func (zs zones) Less(i, j int) bool { return zs[i].UnixName < zs[j].UnixName }
57
const wzURL = "http://unicode.org/cldr/data/common/supplemental/windowsZones.xml"
60
Other string `xml:"other,attr"`
61
Territory string `xml:"territory,attr"`
62
Type string `xml:"type,attr"`
65
type SupplementalData struct {
66
Zones []MapZone `xml:"windowsZones>mapTimezones>mapZone"`
69
func readWindowsZones() (zones, error) {
70
r, err := http.Get(wzURL)
76
data, err := ioutil.ReadAll(r.Body)
81
var sd SupplementalData
82
err = xml.Unmarshal(data, &sd)
87
for _, z := range sd.Zones {
88
if z.Territory != "001" {
89
// to avoid dups. I don't know why.
92
l, err := time.LoadLocation(z.Type)
97
zs = append(zs, &zone{
108
zs, err := readWindowsZones()
120
err = template.Must(template.New("prog").Parse(prog)).Execute(os.Stdout, v)
127
// Copyright 2013 The Go Authors. All rights reserved.
128
// Use of this source code is governed by a BSD-style
129
// license that can be found in the LICENSE file.
131
// generated by genzabbrs.go from
141
var abbrs = map[string]abbr{
142
{{range .Zs}} "{{.WinName}}": {"{{.StTime}}", "{{.DSTime}}"}, // {{.UnixName}}