diff --git a/next_time.go b/next_time.go index 9e9d2b6..92b4708 100644 --- a/next_time.go +++ b/next_time.go @@ -102,6 +102,9 @@ func calculateNextInterval(t time.Time, job JobData) (*time.Time, error) { // 计算下一个执行时间 next := job.CreateTime.Add((intervals + 1) * job.IntervalTime) + // 需要整的 + next = next.Round(job.IntervalTime) + // 确保下次执行时间不早于当前时间 if next.Before(t) || next.Equal(t) { next = next.Add(job.IntervalTime)