From 2639f17aecbf0661ff10bb0210b24bda3987855b Mon Sep 17 00:00:00 2001 From: dongmen <414110582@qq.com> Date: Wed, 15 Dec 2021 13:06:22 +0800 Subject: [PATCH 1/2] tz (ticdc): fix timezone error --- pkg/util/tz.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/util/tz.go b/pkg/util/tz.go index 632e9810860..b1e18043542 100644 --- a/pkg/util/tz.go +++ b/pkg/util/tz.go @@ -14,12 +14,12 @@ package util import ( - "os" "path/filepath" "strings" "time" cerror "github.com/pingcap/ticdc/pkg/errors" + "github.com/pingcap/tidb/util/timeutil" ) // GetTimezone returns the timezone specified by the name @@ -57,9 +57,6 @@ func GetLocalTimezone() (*time.Location, error) { if time.Local.String() != "Local" { return time.Local, nil } - str, err := os.Readlink("/etc/localtime") - if err != nil { - return nil, cerror.WrapError(cerror.ErrLoadTimezone, err) - } + str := timeutil.InferSystemTZ() return getTimezoneFromZonefile(str) } From 6172338000319dbaf0ff8e187ef0c83ccd085b46 Mon Sep 17 00:00:00 2001 From: Neil Shen Date: Mon, 20 Dec 2021 11:25:24 +0800 Subject: [PATCH 2/2] Update tz.go --- pkg/util/tz.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/util/tz.go b/pkg/util/tz.go index 85f06d87a01..77d03e17306 100644 --- a/pkg/util/tz.go +++ b/pkg/util/tz.go @@ -18,8 +18,8 @@ import ( "strings" "time" - cerror "github.com/pingcap/tiflow/pkg/errors" "github.com/pingcap/tidb/util/timeutil" + cerror "github.com/pingcap/tiflow/pkg/errors" ) // GetTimezone returns the timezone specified by the name