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()