From bd67023a356d1b0db677628825fd3fd879c9203b Mon Sep 17 00:00:00 2001 From: cdle Date: Fri, 16 Jun 2023 09:37:19 +0800 Subject: [PATCH] x --- core/init.go | 1 + core/time.go | 14 ++++++++++++++ main.go | 2 -- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 core/time.go diff --git a/core/init.go b/core/init.go index 8ecb177..2a21386 100644 --- a/core/init.go +++ b/core/init.go @@ -18,6 +18,7 @@ import ( var DataHome = utils.GetDataHome() func Init() { + initLoc() sillyGirl = MakeBucket("sillyGirl") _, err := os.Stat(DataHome) if err != nil { diff --git a/core/time.go b/core/time.go new file mode 100644 index 0000000..68fb536 --- /dev/null +++ b/core/time.go @@ -0,0 +1,14 @@ +package core + +import "time" + +var loc *time.Location + +func initLoc() { + var err error + loc, err = time.LoadLocation("Asia/Shanghai") + if err != nil { + loc = time.FixedZone("CST", 8*3600) + } + time.Local = loc +} diff --git a/main.go b/main.go index 3d4ccf4..52fb09d 100644 --- a/main.go +++ b/main.go @@ -18,8 +18,6 @@ import ( var sillyplus = core.MakeBucket("sillyplus") func main() { - loc, _ := time.LoadLocation("Asia/Shanghai") - time.Local = loc core.Init() if sillyplus.GetBool("anti_kasi") { go utils.MonitorGoroutine()