1 Star 0 Fork 0

zhangjungang/beats

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
cron.go 540 Bytes
Copy Edit Raw Blame History
Steffen Siering authored 2016-11-29 15:49 . Update go-ucfg (#3045)
package cron
import (
"time"
"github.com/gorhill/cronexpr"
)
type Schedule cronexpr.Expression
func MustParse(in string) *Schedule {
s, err := Parse(in)
if err != nil {
panic(err)
}
return s
}
func Parse(in string) (*Schedule, error) {
expr, err := cronexpr.Parse(in)
return (*Schedule)(expr), err
}
func (s *Schedule) Next(t time.Time) time.Time {
expr := (*cronexpr.Expression)(s)
return expr.Next(t)
}
func (s *Schedule) Unpack(str string) error {
tmp, err := Parse(str)
if err == nil {
*s = *tmp
}
return err
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangjungang/beats.git
git@gitee.com:zhangjungang/beats.git
zhangjungang
beats
beats
v6.2.0

Search