优化代码

This commit is contained in:
GoEdgeLab
2021-10-12 20:46:45 +08:00
parent 0877fd5632
commit 7e40bdd83f

View File

@@ -19,12 +19,13 @@ func init() {
timeZone = "Asia/Shanghai" timeZone = "Asia/Shanghai"
} }
location, err := time.LoadLocation(sharedNodeConfig.TimeZone) if lastTimeZone != timeZone {
location, err := time.LoadLocation(timeZone)
if err != nil { if err != nil {
remotelogs.Error("TIMEZONE", "change time zone failed: "+err.Error()) remotelogs.Error("TIMEZONE", "change time zone failed: "+err.Error())
return return
} }
if lastTimeZone != timeZone {
remotelogs.Println("TIMEZONE", "change time zone to '"+timeZone+"'") remotelogs.Println("TIMEZONE", "change time zone to '"+timeZone+"'")
time.Local = location time.Local = location
lastTimeZone = timeZone lastTimeZone = timeZone