From: Christopher Allan Webber Date: Thu, 19 Nov 2015 20:22:36 +0000 (-0600) Subject: Add time-+ / time-delta tools X-Git-Tag: v0.1.0~152 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=dcb62711759457507e1a492cb1c21365407327ce;p=8sync.git Add time-+ / time-delta tools --- diff --git a/loopy.scm b/loopy.scm index 5c1455e..70d2d08 100644 --- a/loopy.scm +++ b/loopy.scm @@ -15,7 +15,11 @@ make-time-segment time-segment? time-segment-time time-segment-queue - time-< time-= time-<= + time-< time-= time-<= time-+ + + + make-time-delta time-delta? + time-delta-sec time-delta-usec make-schedule schedule? @@ -127,6 +131,21 @@ (or (time-< time1 time2) (time-= time1 time2))) + +(define-record-type + (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 (make-schedule-intern segments) schedule?