cron icon indicating copy to clipboard operation
cron copied to clipboard

Start cronjob at specific epoc time

Open JSDeve opened this issue 3 years ago • 1 comments

I want to run cronjob at epoc time with millisecond and work every second. But I couldn't find it. The cron starts at 000 millisecond. I need it starts at specific time. For example, at 1657713890300 epoc timestamp, I will Start() it with "@every 1s" time. Cron must be run next times 1657713891300, 1657713892300, 1657713893300. Currently, cron running at 1657713891000, 1657713892000, 1657713893000. Is it possible?

JSDeve avatar Jul 13 '22 12:07 JSDeve

@JSDeve I made a fork of this repo that addresses almost all issues of this repo. https://github.com/alaingilbert/cron

This is how you could do what you want to do ->

_, _ = c.AddJob("* * * * * *", func() {
    // ...
}, cron.WithNext(/* Your time.Time here */))

alaingilbert avatar Apr 16 '25 19:04 alaingilbert