]> gitweb.factorcode.org Git - factor.git/commitdiff
crontab: make parse-cronentry optional in API
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Apr 2023 17:01:18 +0000 (10:01 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Apr 2023 17:01:18 +0000 (10:01 -0700)
extra/crontab/crontab.factor

index 5e6da92718389d0475dd650fdb6dd2c5e127b6c9..15cdceed4bdf5e8d935193a4ecf873eea4fe9632 100644 (file)
@@ -74,6 +74,9 @@ CONSTANT: aliases H{
 
 <PRIVATE
 
+: ?parse-cronentry ( entry -- cronentry )
+    dup cronentry? [ parse-cronentry ] unless ;
+
 :: (next-time-after) ( cronentry timestamp -- )
 
     f ! should we keep searching for a matching time
@@ -124,7 +127,8 @@ CONSTANT: aliases H{
 PRIVATE>
 
 : next-time-after ( cronentry timestamp -- timestamp )
-    1 minutes time+ 0 >>second [ (next-time-after) ] keep ;
+    [ ?parse-cronentry ] dip 1 minutes time+ 0 >>second
+    [ (next-time-after) ] keep ;
 
 : next-time ( cronentry -- timestamp )
     now next-time-after ;