🐛 修复 Windows time.LoadLocation

This commit is contained in:
naiba
2022-03-18 23:45:03 +08:00
parent 3ca23d8d88
commit d73ceaaaa5
3 changed files with 12 additions and 13 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"sort"
"sync"
"time"
"github.com/patrickmn/go-cache"
"github.com/robfig/cron/v3"
@@ -20,6 +21,7 @@ var (
Conf *model.Config
Cache *cache.Cache
DB *gorm.DB
Loc *time.Location
ServerList map[uint64]*model.Server
SecretToID map[string]uint64
@@ -29,6 +31,14 @@ var (
SortedServerLock sync.RWMutex
)
func init() {
var err error
Loc, err = time.LoadLocation("Asia/Shanghai")
if err != nil {
panic(err)
}
}
func ReSortServer() {
ServerLock.RLock()
defer ServerLock.RUnlock()