packagecronimport"time"// ConstantDelaySchedule represents a simple recurring duty cycle, e.g. "Every 5 minutes".// It does not support jobs more frequent than once a second.typeConstantDelaySchedulestruct{Delaytime.Duration}// Every returns a crontab Schedule that activates once every duration.// Delays of less than a second are not supported (will round up to 1 second).// Any fields less than a Second are truncated.funcEvery(durationtime.Duration)ConstantDelaySchedule{ifduration<time.Second{duration=time.Second}returnConstantDelaySchedule{Delay:duration-time.Duration(duration.Nanoseconds())%time.Second,}}// Next returns the next time this should be run.// This rounds so that the next activation time will be on the second.func(scheduleConstantDelaySchedule)Next(ttime.Time)time.Time{returnt.Add(schedule.Delay-time.Duration(t.Nanosecond())*time.Nanosecond)}