From 2699da180967e5d5dab2cc64deeca4680bf2b2fb Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Fri, 13 May 2016 14:26:30 +1000 Subject: [PATCH] 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 --- src/time/zoneinfo_test.go | 9 +++++++++ src/time/zoneinfo_windows.go | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go index 0b7584ab9c..4b50dc5090 100644 --- a/src/time/zoneinfo_test.go +++ b/src/time/zoneinfo_test.go @@ -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) + } +} diff --git a/src/time/zoneinfo_windows.go b/src/time/zoneinfo_windows.go index c753119d5d..a6546f54b8 100644 --- a/src/time/zoneinfo_windows.go +++ b/src/time/zoneinfo_windows.go @@ -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++ -- 2.48.1