diff options
author | qmuntal <quimmuntal@gmail.com> | 2023-09-12 15:32:22 +0200 |
---|---|---|
committer | Quim Muntal <quimmuntal@gmail.com> | 2023-09-14 07:20:34 +0000 |
commit | de4ead8102c3ba5dc9475ed3e117b2c50220b4df (patch) | |
tree | 1c8798a3e9eb8e02b449f82c8638068029f960b6 /src/time | |
parent | 856cf23a8acfa14756a6e9b82ace76f5604262c9 (diff) | |
download | go-de4ead8102c3ba5dc9475ed3e117b2c50220b4df.tar.gz go-de4ead8102c3ba5dc9475ed3e117b2c50220b4df.zip |
time: unconditionally use RegLoadMUIString on Windows
RegLoadMUIString is supported on Windows Vista and later, so this
should be safe to do unconditionally.
While here, also unconditionally use GetDynamicTimeZoneInformation
in syscall/windows/registry tests, since it's also supported on Windows
Vista and later.
Change-Id: Ifa32a81f4727d4810f2b9ccc814aa77a43513e59
Reviewed-on: https://go-review.googlesource.com/c/go/+/527595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Diffstat (limited to 'src/time')
-rw-r--r-- | src/time/zoneinfo_windows.go | 14 | ||||
-rw-r--r-- | src/time/zoneinfo_windows_test.go | 10 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/time/zoneinfo_windows.go b/src/time/zoneinfo_windows.go index 76d79759f7..c9f38ea3e0 100644 --- a/src/time/zoneinfo_windows.go +++ b/src/time/zoneinfo_windows.go @@ -20,8 +20,8 @@ var platformZoneSources []string // none: Windows uses system calls instead // time apply to all previous and future years as well. // matchZoneKey checks if stdname and dstname match the corresponding key -// values "MUI_Std" and MUI_Dlt" or "Std" and "Dlt" (the latter down-level -// from Vista) in the kname key stored under the open registry key zones. +// values "MUI_Std" and MUI_Dlt" or "Std" and "Dlt" in the kname key stored +// under the open registry key zones. func matchZoneKey(zones registry.Key, kname string, stdname, dstname string) (matched bool, err2 error) { k, err := registry.OpenKey(zones, kname, registry.READ) if err != nil { @@ -30,12 +30,10 @@ func matchZoneKey(zones registry.Key, kname string, stdname, dstname string) (ma defer k.Close() var std, dlt string - if err = registry.LoadRegLoadMUIString(); err == nil { - // Try MUI_Std and MUI_Dlt first, fallback to Std and Dlt if *any* error occurs - std, err = k.GetMUIStringValue("MUI_Std") - if err == nil { - dlt, err = k.GetMUIStringValue("MUI_Dlt") - } + // Try MUI_Std and MUI_Dlt first, fallback to Std and Dlt if *any* error occurs + std, err = k.GetMUIStringValue("MUI_Std") + if err == nil { + dlt, err = k.GetMUIStringValue("MUI_Dlt") } if err != nil { // Fallback to Std and Dlt if std, _, err = k.GetStringValue("Std"); err != nil { diff --git a/src/time/zoneinfo_windows_test.go b/src/time/zoneinfo_windows_test.go index f23d9dcecb..5196b8e1de 100644 --- a/src/time/zoneinfo_windows_test.go +++ b/src/time/zoneinfo_windows_test.go @@ -45,12 +45,10 @@ func TestToEnglishName(t *testing.T) { defer k.Close() var std, dlt string - if err = registry.LoadRegLoadMUIString(); err == nil { - // Try MUI_Std and MUI_Dlt first, fallback to Std and Dlt if *any* error occurs - std, err = k.GetMUIStringValue("MUI_Std") - if err == nil { - dlt, err = k.GetMUIStringValue("MUI_Dlt") - } + // Try MUI_Std and MUI_Dlt first, fallback to Std and Dlt if *any* error occurs + std, err = k.GetMUIStringValue("MUI_Std") + if err == nil { + dlt, err = k.GetMUIStringValue("MUI_Dlt") } if err != nil { // Fallback to Std and Dlt if std, _, err = k.GetStringValue("Std"); err != nil { |