1 // Copyright 2011 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.
5 // Parse Plan 9 timezone(2) files.
14 func parseZones(s string) (zt []zonetime) {
15 f := strings.Fields(s)
20 // standard timezone offset
21 o, err := strconv.Atoi(f[1])
25 std := &zone{name: f[0], utcoff: o, isdst: false}
27 // alternate timezone offset
28 o, err = strconv.Atoi(f[3])
32 dst := &zone{name: f[2], utcoff: o, isdst: true}
34 // transition time pairs
36 for i := 0; i < len(f); i++ {
41 t, err := strconv.Atoi(f[i])
46 zt = append(zt, zonetime{time: int32(t), zone: z})
52 t, err := os.Getenverror("timezone")
54 // do nothing: use UTC
60 func initTestingZone() {
61 buf, err := readFile("/adm/timezone/US_Pacific")
65 zones = parseZones(string(buf))