Commit e2a30b8f authored by Kenny Grant's avatar Kenny Grant Committed by Ian Lance Taylor

time: genzabbrs.go skips Feb when checking months

getAbbrs looks like it is checking each month looking for a change
in the time zone abbreviation, but starts in Dec of the previous year
and skips the month of February because of the overflow rules for
AddDate. Changing the day to 1 starts at Jan 1 and tries all months
in the current year. This isn't very important or likely to change
output as zones usually span several months. Discovered when
looking into time.AddDate behavior when adding months.

Change-Id: I685254c8d21c402ba82cc4176e9a86b64ce8f7f7
Reviewed-on: https://go-review.googlesource.com/23322Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 6662897b
...@@ -30,7 +30,7 @@ var filename = flag.String("output", "zoneinfo_abbrs_windows.go", "output file n ...@@ -30,7 +30,7 @@ var filename = flag.String("output", "zoneinfo_abbrs_windows.go", "output file n
// getAbbrs finds timezone abbreviations (standard and daylight saving time) // getAbbrs finds timezone abbreviations (standard and daylight saving time)
// for location l. // for location l.
func getAbbrs(l *time.Location) (st, dt string) { func getAbbrs(l *time.Location) (st, dt string) {
t := time.Date(time.Now().Year(), 0, 0, 0, 0, 0, 0, l) t := time.Date(time.Now().Year(), 0, 1, 0, 0, 0, 0, l)
abbr1, off1 := t.Zone() abbr1, off1 := t.Zone()
for i := 0; i < 12; i++ { for i := 0; i < 12; i++ {
t = t.AddDate(0, 1, 0) t = t.AddDate(0, 1, 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment