kit/cron
Alessandro (Ale) Segala 2d30434d91
Update linter to 1.55.1 and fix linter errors (#71)
* Update linter to 1.55.1 and fix linter errors

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Also disable tagalign linter

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

---------

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
2023-10-30 11:55:29 -07:00
..
.gitignore add cron fork (#31) 2022-12-01 12:22:46 -08:00
.travis.yml add cron fork (#31) 2022-12-01 12:22:46 -08:00
LICENSE add cron fork (#31) 2022-12-01 12:22:46 -08:00
README.md Remove deprecated package github.com/benbjohnson/clock (#55) 2023-08-05 20:42:49 -07:00
chain.go Remove deprecated package github.com/benbjohnson/clock (#55) 2023-08-05 20:42:49 -07:00
chain_test.go Update linter to 1.55.1 and fix linter errors (#71) 2023-10-30 11:55:29 -07:00
constantdelay.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
constantdelay_test.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
cron.go Update linter to 1.55.1 and fix linter errors (#71) 2023-10-30 11:55:29 -07:00
cron_test.go Update linter to 1.55.1 and fix linter errors (#71) 2023-10-30 11:55:29 -07:00
doc.go Remove deprecated package github.com/benbjohnson/clock (#55) 2023-08-05 20:42:49 -07:00
logger.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
option.go Remove deprecated package github.com/benbjohnson/clock (#55) 2023-08-05 20:42:49 -07:00
option_test.go Update linter to 1.55.1 and fix linter errors (#71) 2023-10-30 11:55:29 -07:00
parser.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
parser_test.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
spec.go add cron fork (#31) 2022-12-01 12:22:46 -08:00
spec_test.go Use mocked clock in cron tests, rather than wall clock (#66) 2023-10-23 09:53:28 -07:00

README.md

Cron

This package is a fork of github.com/robfig/cron/v3@v3.0.0 which adds support for mocking the time using k8s.io/utils/clock

See LICENSE for the license of the original package.

Using Cron with Mock Clock

import "k8s.io/utils/clock"

clk := clock.RealClock{}
c := cron.New(cron.WithClock(clk))
c.AddFunc("@every 1h", func() {
 fmt.Println("Every hour")
})
c.Start()
clk.Add(1 * time.Hour)