We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 69c152c commit 0798dc2Copy full SHA for 0798dc2
constantdelay.go
@@ -19,7 +19,7 @@ func Every(duration time.Duration) ConstantDelaySchedule {
19
duration = time.Second
20
}
21
return ConstantDelaySchedule{
22
- Delay: duration - time.Duration(duration.Nanoseconds())%time.Second,
+ Delay: duration.Truncate(time.Second),
23
24
25
@@ -42,7 +42,7 @@ func (schedule ConstantDelaySchedule) Next(t time.Time) time.Time {
42
t = schedule.startAt.Add((t.Sub(schedule.startAt) / schedule.Delay) * (schedule.Delay))
43
44
45
- return t.Add(schedule.Delay - time.Duration(t.Nanosecond())*time.Nanosecond)
+ return t.Add(schedule.Delay).Truncate(time.Second)
46
47
48
func (schedule ConstantDelaySchedule) IsOnce() bool {
0 commit comments