Skip to content

A Go time.Ticker like implementation that works with a cron schedule.

License

Notifications You must be signed in to change notification settings

martin-viggiano/cronticker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⏰ cronticker

cronticker implements a ticker that works with crontab schedules.

🚀 Install

go get github.com/martin-viggiano/cronticker

📚 Usage

Go doc: https://pkg.go.dev/github.com/martin-viggiano/cronticker

import (
	"log"

	"github.com/martin-viggiano/cronticker"
)

func main() {
	ticker, err := cronticker.NewTicker("5 4 * * *")
	if err != nil {
		log.Fatal("failed to create ticker")
	}
	defer ticker.Stop()

	select {
	case <-ticker.C:
		log.Print("it is 04:05")
	}

	err = ticker.Reset("5 4 * * *")
}

ℹ️ Useful links

About

A Go time.Ticker like implementation that works with a cron schedule.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages