robfig / cron

a cron library for go
MIT License
13.15k stars 1.63k forks source link

does this package support standard crontab expr #502

Closed zhuliquan closed 12 months ago

zhuliquan commented 1 year ago

according to README.md, this package support standard crontab expr

Howevery, I find some expr run error.

For example. expr * * * * * means run every minute in standard crontab expr. (you can check meaning of crontab expr on this website). But in this package, I find it run every second. I'am very confused.

test code (in v1.2.0)

package main

import (
    "fmt"
    "time"

    "github.com/robfig/cron"
)

func main() {
    job := cron.New()
    job.AddFunc("* * * * *", func() {
        fmt.Printf("run at %s\n", time.Now())
    })
    job.Start()

    select {}
}
vfaberd commented 1 year ago

@zhuliquan note that you are not using the latest version Changing your import to import "github.com/robfig/cron/v3" should solve the problem