From 6a392fdb91268b1b478c3044660fc78b7baa9b4b Mon Sep 17 00:00:00 2001 From: Mathias Lafeldt Date: Tue, 19 Jul 2016 14:41:46 +0200 Subject: [PATCH] Add @minutely as pre-defined schedule --- README.md | 1 + cronexpr_parse.go | 4 +++- cronexpr_test.go | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e8c56d2..0e4a464 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Predefined cron expressions @weekly Run once a week at midnight in the morning of Sunday 0 0 0 * * 0 * @daily Run once a day at midnight 0 0 0 * * * * @hourly Run once an hour at the beginning of the hour 0 0 * * * * * + @minutely Run once a minute at the beginning of the minute 0 * * * * * * @reboot Not supported Other details diff --git a/cronexpr_parse.go b/cronexpr_parse.go index aeb8296..a0d596c 100644 --- a/cronexpr_parse.go +++ b/cronexpr_parse.go @@ -204,7 +204,9 @@ var cronNormalizer = strings.NewReplacer( "@monthly", "0 0 0 1 * * *", "@weekly", "0 0 0 * * 0 *", "@daily", "0 0 0 * * * *", - "@hourly", "0 0 * * * * *") + "@hourly", "0 0 * * * * *", + "@minutely", "0 * * * * * *", +) /******************************************************************************/ diff --git a/cronexpr_test.go b/cronexpr_test.go index b729170..6a437ff 100644 --- a/cronexpr_test.go +++ b/cronexpr_test.go @@ -278,7 +278,7 @@ func TestNextN_every5min(t *testing.T) { for i, next := range result { nextStr := next.Format("Mon, 2 Jan 2006 15:04:05") if nextStr != expected[i] { - t.Errorf(`MustParse("*/5 * * * *").NextN("2013-09-02 08:44:30", 5):\n"`) + t.Errorf(`MustParse("*/5 * * * *").NextN("2013-09-02 08:44:30", 5):\n"`) t.Errorf(` result[%d]: expected "%s" but got "%s"`, i, expected[i], nextStr) } } @@ -287,6 +287,7 @@ func TestNextN_every5min(t *testing.T) { /******************************************************************************/ var benchmarkExpressions = []string{ + "@minutely", "* * * * *", "@hourly", "@weekly",