From d784651ee5e4a81ebf40f92e33ef8a835c55e6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B7=AF=E8=B7=AF?= Date: Sat, 7 Mar 2026 10:15:20 +0800 Subject: [PATCH] refactor(cron): extract defaultTimezone constant Per reviewer suggestion, replace hardcoded "UTC" with a package-level constant for maintainability. --- pkg/cron/service.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/cron/service.go b/pkg/cron/service.go index 136caed16..c2e225743 100644 --- a/pkg/cron/service.go +++ b/pkg/cron/service.go @@ -15,6 +15,8 @@ import ( "github.com/sipeed/picoclaw/pkg/fileutil" ) +const defaultTimezone = "UTC" + type CronSchedule struct { Kind string `json:"kind"` AtMS *int64 `json:"atMs,omitempty"` @@ -273,7 +275,7 @@ func (cs *CronService) computeNextRun(schedule *CronSchedule, nowMS int64) *int6 tz = cs.defaultTZ } if tz == "" { - tz = "UTC" + tz = defaultTimezone } if loc, err := time.LoadLocation(tz); err == nil { now = now.In(loc)