refactor(cron): extract defaultTimezone constant
Per reviewer suggestion, replace hardcoded "UTC" with a package-level constant for maintainability.
This commit is contained in:
parent
038a55e522
commit
d784651ee5
1 changed files with 3 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue