From ea83c1c1ee8f9dc7eb30d662b164c190b0b00eda Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 22 Mar 2019 20:42:46 -0700 Subject: [PATCH] crontab: constraint order is month, day, day-of-week, hour, minute. --- extra/crontab/crontab.factor | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/extra/crontab/crontab.factor b/extra/crontab/crontab.factor index fc64c93251..0b09c3c07e 100644 --- a/extra/crontab/crontab.factor +++ b/extra/crontab/crontab.factor @@ -76,6 +76,14 @@ CONSTANT: aliases H{ cronentry days>> first >>day 1 +month ] if* [ cronentry timestamp (next-time-after) ] when + timestamp day-of-week :> weekday + cronentry days-of-week>> [ weekday >= ] find nip [ + cronentry days-of-week>> first 7 + + ] unless* weekday - [ + timestamp 0 >>hour 0 >>minute swap +day drop + cronentry timestamp (next-time-after) + ] unless-zero + timestamp hour>> :> hour cronentry hours>> [ hour >= ] find nip [ dup hour = [ drop f ] [ @@ -91,15 +99,7 @@ CONSTANT: aliases H{ dup minute = [ drop f ] [ timestamp minute<< t ] if ] [ timestamp cronentry minutes>> first >>minute 1 +hour - ] if* [ cronentry timestamp (next-time-after) ] when - - timestamp day-of-week :> weekday - cronentry days-of-week>> [ weekday >= ] find nip [ - cronentry days-of-week>> first 7 + - ] unless* weekday - [ - timestamp swap +day drop - cronentry timestamp (next-time-after) - ] unless-zero ; + ] if* [ cronentry timestamp (next-time-after) ] when ; PRIVATE>