1
0
mirror of https://github.com/golang/go synced 2024-09-25 03:10:12 -06:00

time: set Local.name on windows

Local.String() returns "Local" on every OS, but windows.
Change windows code to do like others.

Updates #15568

Change-Id: I7a4d2713d940e2a01cff9d7f5cefc89def07546a
Reviewed-on: https://go-review.googlesource.com/23078
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Alex Brainman 2016-05-13 14:26:30 +10:00 committed by Brad Fitzpatrick
parent 5f833121cb
commit 2699da1809
2 changed files with 11 additions and 0 deletions

View File

@ -61,3 +61,12 @@ func TestFirstZone(t *testing.T) {
}
}
}
func TestLocationNames(t *testing.T) {
if time.Local.String() != "Local" {
t.Errorf(`invalid Local location name: got %q want "Local"`, time.Local)
}
if time.UTC.String() != "UTC" {
t.Errorf(`invalid UTC location name: got %q want "UTC"`, time.UTC)
}
}

View File

@ -140,6 +140,8 @@ func pseudoUnix(year int, d *syscall.Systemtime) int64 {
func initLocalFromTZI(i *syscall.Timezoneinformation) {
l := &localLoc
l.name = "Local"
nzone := 1
if i.StandardDate.Month > 0 {
nzone++