* Load zoneinfo from TZ and ZONEINFO env (#2279)

This commit is contained in:
lxowalle 2026-04-03 10:12:15 +08:00 committed by GitHub
parent 8aa110c02a
commit 849e37cf79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -9,6 +9,7 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"time"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -68,6 +69,21 @@ const (
func main() { func main() {
fmt.Printf("%s", banner) fmt.Printf("%s", banner)
tz_env := os.Getenv("TZ")
if tz_env != "" {
fmt.Println("TZ environment:", tz_env)
zoneinfo_env := os.Getenv("ZONEINFO")
fmt.Println("ZONEINFO environment:", zoneinfo_env)
loc, err := time.LoadLocation(tz_env)
if err != nil {
fmt.Println("Error loading time zone:", err)
} else {
fmt.Println("Time zone loaded successfully:", loc)
time.Local = loc //nolint:gosmopolitan // We intentionally set local timezone from TZ env
}
}
cmd := NewPicoclawCommand() cmd := NewPicoclawCommand()
if err := cmd.Execute(); err != nil { if err := cmd.Execute(); err != nil {
os.Exit(1) os.Exit(1)