From f1dc2b82f999a7c2ff110220b54ab1e9bb63fe43 Mon Sep 17 00:00:00 2001 From: guanzi008 <245205080@qq.com> Date: Wed, 31 Aug 2022 15:00:41 +0800 Subject: [PATCH] Update gocos.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(时区设置): 默认北京时区 --- gocos.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gocos.go b/gocos.go index e34f9c8..1a59d3f 100644 --- a/gocos.go +++ b/gocos.go @@ -56,11 +56,8 @@ func VarIsEmpty(a ...interface{}) bool { } func init() { - tz := os.Getenv("TZ") - if tz == "" { - tz = "Asia/Shanghai" - } - time.Local, _ = time.LoadLocation(tz) + var cstZone = time.FixedZone("CST", 8*3600) // 东八 + time.Local = cstZone } func main() {