Source File
constantdelay.go
Belonging Package
github.com/robfig/cron/v3
package cronimport// ConstantDelaySchedule represents a simple recurring duty cycle, e.g. "Every 5 minutes".// It does not support jobs more frequent than once a second.type ConstantDelaySchedule struct {Delay time.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.func ( time.Duration) ConstantDelaySchedule {if < time.Second {= time.Second}return ConstantDelaySchedule{Delay: - time.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 ( ConstantDelaySchedule) ( time.Time) time.Time {return .Add(.Delay - time.Duration(.Nanosecond())*time.Nanosecond)}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |