SummaryRefsLogTreeCommitDiffStats
path: root/src/mcron
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2018-03-26 16:56:40 +0200
committerMathieu Lirzin <mthl@gnu.org>2018-03-26 17:51:11 +0200
commitf71b0b8310e6b297866147a11e3fd0dd5db13beb (patch)
tree3d408a2bb28eeab7b598fa0ad7dde822fae0e974 /src/mcron
parentfad58ca8c221def75093463e917f66fc006f3df5 (diff)
downloadmcron-f71b0b8310e6b297866147a11e3fd0dd5db13beb.tar.gz
mcron-f71b0b8310e6b297866147a11e3fd0dd5db13beb.tar.bz2
mcron-f71b0b8310e6b297866147a11e3fd0dd5db13beb.zip
job-specifier: Adapt 'bump-time' to 'next-...-from' procedures
This is a follow-up to commit 913e3c65e4f56476e8ac69f4892cf92c125751ec. Since 'next-...-from' procedures now uses an '#:optional' argument instead of a dotted optional arguments list, 'bump-time' doesn't need to unwrap VALUE-LIST anymore. * src/mcron/job-specifier.scm (bump-time): Pass VALUE-LIST directly to '%find-best-next'. * tests/job-specifier.scm ("next-hour-from"): New test. * NEWS: Update. Reported-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'src/mcron')
-rw-r--r--src/mcron/job-specifier.scm24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/mcron/job-specifier.scm b/src/mcron/job-specifier.scm
index e3b3391..d3d3a2a 100644
--- a/src/mcron/job-specifier.scm
+++ b/src/mcron/job-specifier.scm
@@ -85,21 +85,15 @@ go into the list. For example, (range 1 6 2) returns '(1 3 5)."
;;
;; ... except that the function is actually generalized to deal with
;; seconds, minutes, etc., in an obvious way :-)
- ;;
- ;; Note that value-list always comes from an optional argument to a
- ;; procedure, so is wrapped up as the first element of a list (i.e. it is a
- ;; list inside a list).
- (match value-list
- (()
- (set-component! time (1+ (component time))))
- ((val . rest)
- (match (%find-best-next (component time) val)
- ((smallest . closest+)
- (cond ((inf? closest+)
- (set-higher-component! time (1+ (higher-component time)))
- (set-component! time smallest))
- (else
- (set-component! time closest+)))))))
+ (if (null? value-list)
+ (set-component! time (1+ (component time)))
+ (match (%find-best-next (component time) value-list)
+ ((smallest . closest+)
+ (cond ((inf? closest+)
+ (set-higher-component! time (1+ (higher-component time)))
+ (set-component! time smallest))
+ (else
+ (set-component! time closest+))))))
(first (mktime time)))
;; Set of configuration methods which use the above general function to bump