From 549eee700e192219a27c0e77b502dbd9c813d276 Mon Sep 17 00:00:00 2001 From: Yun Date: Thu, 18 Sep 2025 16:23:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=97=B4=E9=9A=94=E7=9A=84?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=95=B4=E5=9D=97=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E8=B5=B0=E5=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next_time.go | 3 +++ 1 file changed, 3 insertions(+) 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)