aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-11-30 15:45:24 -0500
committerRuss Cox <rsc@golang.org>2011-11-30 15:45:24 -0500
commit97197a6248e5239fc3491f8acbd1dccc5ec3d509 (patch)
tree87670788900cbce0be6dd94bb46d8dbfacc7d3e1
parent06e635e46ded747737c26b74c088b48257883baa (diff)
downloadgo-97197a6248e5239fc3491f8acbd1dccc5ec3d509.tar.gz
go-97197a6248e5239fc3491f8acbd1dccc5ec3d509.zip
time: fix windows build
TBR=brainman CC=golang-dev https://golang.org/cl/5447057
-rw-r--r--src/pkg/time/zoneinfo_windows.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/pkg/time/zoneinfo_windows.go b/src/pkg/time/zoneinfo_windows.go
index 0c8a8076ef..5eba0ac97b 100644
--- a/src/pkg/time/zoneinfo_windows.go
+++ b/src/pkg/time/zoneinfo_windows.go
@@ -28,12 +28,10 @@ func abbrev(name []uint16) string {
//
// http://social.msdn.microsoft.com/Forums/eu/vclanguage/thread/a87e1d25-fb71-4fe0-ae9c-a9578c9753eb
// http://stackoverflow.com/questions/4195948/windows-time-zone-abbreviations-in-asp-net
- short := make([]rune, len(name))
- w := 0
+ var short []rune
for _, c := range name {
if 'A' <= c && c <= 'Z' {
- short[w] = rune(c)
- w++
+ short = append(short, rune(c))
}
}
return string(short)
@@ -78,18 +76,23 @@ func initLocalFromTZI(i *syscall.Timezoneinformation) {
std := &l.zone[0]
std.name = abbrev(i.StandardName[0:])
- std.offset = -int(i.StandardBias) * 60
if nzone == 1 {
// No daylight savings.
+ std.offset = -int(i.Bias) * 60
l.cacheStart = -1 << 63
l.cacheEnd = 1<<63 - 1
l.cacheZone = std
return
}
+ // StandardBias must be ignored if StandardDate is not set,
+ // so this computation is delayed until after the nzone==1
+ // return above.
+ std.offset = -int(i.Bias+i.StandardBias) * 60
+
dst := &l.zone[1]
dst.name = abbrev(i.DaylightName[0:])
- dst.offset = std.offset + -int(i.DaylightBias)*60
+ dst.offset = -int(i.Bias+i.DaylightBias) * 60
dst.isDST = true
// Arrange so that d0 is first transition date, d1 second,