This commit is contained in:
vipg
2026-02-10 10:57:11 +08:00
parent a33e6be08f
commit 8eb9adda68
4 changed files with 20 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import (
"os"
"fmt"
"path/filepath"
"time"
)
type Logger interface {
@@ -64,3 +65,15 @@ func SetupFile(path string) error {
}
return nil
}
func SetupTimezone(tz string) error {
if tz == "" {
return fmt.Errorf("timezone empty")
}
loc, err := time.LoadLocation(tz)
if err != nil {
return err
}
time.Local = loc
return nil
}