aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/gogits/cron/constantdelay.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2018-05-27 09:07:15 +0800
committerUnknwon <u@gogs.io>2018-05-27 09:07:15 +0800
commite33d9e77f43e6829ea967e47964d13f5a8aec5cc (patch)
treeace1a09414a66fd7e293b3837865633168ba4f6e /vendor/github.com/gogits/cron/constantdelay.go
parentaff42082441715559bb2e62e11550af1a946a8c9 (diff)
vendor: rename "gogits" to "gogs"
Diffstat (limited to 'vendor/github.com/gogits/cron/constantdelay.go')
-rw-r--r--vendor/github.com/gogits/cron/constantdelay.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/vendor/github.com/gogits/cron/constantdelay.go b/vendor/github.com/gogits/cron/constantdelay.go
deleted file mode 100644
index cd6e7b1b..00000000
--- a/vendor/github.com/gogits/cron/constantdelay.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package cron
-
-import "time"
-
-// 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 Every(duration time.Duration) ConstantDelaySchedule {
- if duration < time.Second {
- duration = time.Second
- }
- return ConstantDelaySchedule{
- 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 (schedule ConstantDelaySchedule) Next(t time.Time) time.Time {
- return t.Add(schedule.Delay - time.Duration(t.Nanosecond())*time.Nanosecond)
-}