diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2016-04-20 04:31:52 +0200 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2016-05-07 23:38:53 +0200 |
commit | 5097e30babe31a40a3fb8e281fee2a472414e5f8 (patch) | |
tree | d646ccb6dcc9de9b6a347b58fbf37ac0368ed4b1 /scm/mcron/vixie-time.scm | |
parent | 5da0024b934513aa76a2cb32dc8f6cb00370262a (diff) | |
download | mcron-5097e30babe31a40a3fb8e281fee2a472414e5f8.tar.gz mcron-5097e30babe31a40a3fb8e281fee2a472414e5f8.tar.bz2 mcron-5097e30babe31a40a3fb8e281fee2a472414e5f8.zip |
job-specifier: Add '%find-best-next' procedure.
* scm/mcron/job-specifier.scm (find-best-next): Rename to ...
(%find-best-next): ... this. Rewrite it using a functional style.
All callers changed.
Diffstat (limited to 'scm/mcron/vixie-time.scm')
-rw-r--r-- | scm/mcron/vixie-time.scm | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/scm/mcron/vixie-time.scm b/scm/mcron/vixie-time.scm index 2f26a6d..a91fa89 100644 --- a/scm/mcron/vixie-time.scm +++ b/scm/mcron/vixie-time.scm @@ -15,15 +15,13 @@ ;; You should have received a copy of the GNU General Public License along ;; with GNU mcron. If not, see <http://www.gnu.org/licenses/>. - (define-module (mcron vixie-time) - #:export (parse-vixie-time) - #:use-module (mcron job-specifier)) - - -(use-modules (srfi srfi-1) (srfi srfi-13) (srfi srfi-14) - (ice-9 regex)) - + #:use-module (ice-9 regex) + #:use-module (mcron job-specifier) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-13) + #:use-module (srfi srfi-14) + #:export (parse-vixie-time)) ;; In Vixie-style time specifications three-letter symbols are allowed to stand ;; for the numbers corresponding to months and days of the week. We deal with @@ -179,11 +177,12 @@ ;; simply unreadable without all of these aliases. (define (increment-time-component time time-spec) - (let* ((time-list (time-spec:list time-spec)) - (getter (time-spec:getter time-spec)) - (setter (time-spec:setter time-spec)) - (next-best (find-best-next (getter time) time-list)) - (wrap-around (eqv? (cdr next-best) 9999))) + (let* ((time-list (time-spec:list time-spec)) + (getter (time-spec:getter time-spec)) + (setter (time-spec:setter time-spec)) + (find-best-next (@@ (mcron job-specifier) %find-best-next)) + (next-best (find-best-next (getter time) time-list)) + (wrap-around (eqv? (cdr next-best) 9999))) (setter time ((if wrap-around car cdr) next-best)) wrap-around)) |