projects
/
8sync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add time to the agenda
[8sync.git]
/
loopy.scm
diff --git
a/loopy.scm
b/loopy.scm
index f11b6b8503b2d235c00544b31956052ff718c28e..6f1516fdb51449be60c4c952b2d024b97369e968 100644
(file)
--- a/
loopy.scm
+++ b/
loopy.scm
@@
-60,12
+60,13
@@
;;; and with reasonable separation from functional components?
(define-immutable-record-type <agenda>
;;; and with reasonable separation from functional components?
(define-immutable-record-type <agenda>
- (make-agenda-intern queue prompt-tag port-mapping schedule)
+ (make-agenda-intern queue prompt-tag port-mapping schedule
time
)
agenda?
(queue agenda-queue)
(prompt-tag agenda-prompt-tag)
(port-mapping agenda-port-mapping)
agenda?
(queue agenda-queue)
(prompt-tag agenda-prompt-tag)
(port-mapping agenda-port-mapping)
- (schedule agenda-schedule))
+ (schedule agenda-schedule)
+ (time agenda-time))
(define (make-async-prompt-tag)
(make-prompt-tag "prompt"))
(define (make-async-prompt-tag)
(make-prompt-tag "prompt"))
@@
-74,8
+75,9
@@
(queue (make-q))
(prompt (make-prompt-tag))
(port-mapping (make-port-mapping))
(queue (make-q))
(prompt (make-prompt-tag))
(port-mapping (make-port-mapping))
- (schedule (make-schedule)))
- (make-agenda-intern queue prompt port-mapping schedule))
+ (schedule (make-schedule))
+ (time (gettimeofday)))
+ (make-agenda-intern queue prompt port-mapping schedule time))
\f
\f
@@
-290,7
+292,11
@@
(agenda-run-once agenda))))
(if (and stop-condition (stop-condition agenda))
'done
(agenda-run-once agenda))))
(if (and stop-condition (stop-condition agenda))
'done
- (loop new-agenda)))))
+ (loop
+ ;; Adjust the agenda's time just in time
+ ;; We do this here rather than in agenda-run-once to make
+ ;; agenda-run-once's behavior fairly predictable
+ (set-field new-agenda (agenda-time) (gettimeofday)))))))
(define (agenda-run-once agenda)
"Run once through the agenda, and produce a new agenda
(define (agenda-run-once agenda)
"Run once through the agenda, and produce a new agenda