From d7407628b3675368a5de42710d96bb23aa1981d1 Mon Sep 17 00:00:00 2001 From: wood chen Date: Wed, 18 Sep 2024 01:56:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84(main.go=20&=20binance.go):?= =?UTF-8?q?=20=E7=A7=BB=E9=99=A4=E5=AF=B9time.LoadLocation=E7=9A=84?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=EF=BC=8C=E4=BC=98=E5=8C=96=E6=97=B6=E5=8C=BA?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8C=E5=A2=9E=E5=BC=BA=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=81=A5=E5=A3=AE=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 7 +------ service/binance.go | 4 ---- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/main.go b/main.go index 11b35fe..98d8175 100644 --- a/main.go +++ b/main.go @@ -25,12 +25,7 @@ func init() { } func setTimeZone() { - loc, err := time.LoadLocation("Asia/Singapore") - if err != nil { - log.Printf("Error loading time zone 'Asia/Singapore': %v", err) - log.Println("Falling back to UTC") - loc = time.UTC - } + loc := time.FixedZone("Asia/Singapore", 8*60*60) time.Local = loc } diff --git a/service/binance.go b/service/binance.go index 26f1655..5e9c51e 100644 --- a/service/binance.go +++ b/service/binance.go @@ -27,10 +27,6 @@ func init() { botToken = os.Getenv("BOT_TOKEN") chatID = mustParseInt64(os.Getenv("CHAT_ID")) symbols = strings.Split(os.Getenv("SYMBOLS"), ",") - singaporeTZ, err = time.LoadLocation("Asia/Singapore") - if err != nil { - log.Fatal(err) - } bot, err = tgbotapi.NewBotAPI(botToken) if err != nil {