make-time-segment time-segment?
time-segment-time time-segment-queue
- time-< time-= time-<=
+ time-< time-= time-<= time-+
+
+ <time-delta>
+ make-time-delta time-delta?
+ time-delta-sec time-delta-usec
<schedule>
make-schedule schedule?
(or (time-< time1 time2)
(time-= time1 time2)))
+
+(define-record-type <time-delta>
+ (make-time-delta-intern sec usec)
+ time-delta?
+ (sec time-delta-sec)
+ (usec time-delta-usec))
+
+(define* (make-time-delta sec #:optional usec)
+ (make-time-delta-intern sec (or usec 0)))
+
+(define (time-+ time time-delta)
+ (cons (+ (car time) (time-delta-sec time-delta))
+ (+ (cdr time) (time-delta-usec time-delta))))
+
+
(define-record-type <schedule>
(make-schedule-intern segments)
schedule?
(agenda-run-once agenda))))
(if (and stop-condition (stop-condition agenda))
'done
- (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)))))))
+ (let ((updated-agenda
+ ;; 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))))
+ (loop updated-agenda))))))
(define (agenda-run-once agenda)
"Run once through the agenda, and produce a new agenda