+
+;;; Schedule
+;;;
+;;; This is where we handle timed events for the future
+
+;; This section totally borrows from SICP
+;; <3 <3 <3
+
+;; NOTE: time is a cons of (seconds . microseconds)
+
+(define-record-type <time-segment>
+ (make-time-segment-intern time queue)
+ time-segment?
+ (time time-segment-time)
+ (queue time-segment-queue time-segment-set-queue!))
+
+(define* (make-time-segment time #:optional (queue (make-q)))
+ (let ((time (match time
+ ;; time was just an integer (just the second)
+ ((? integer? _) (cons time 0))
+ ;; time is already a cons of second and microsecnd
+ (((? integer? s) (? integer? u)) time)
+ (_ (throw 'invalid-time "Invalid time" time)))))
+ (make-time-segment-intern time queue)))
+
+(define (make-schedule)
+ '())
+
+(define (schedule-add-new-segment! schedule time)
+ (error))
+
+(define (schedule-add! schedule time proc)
+ ;; Find and add a schedule segment
+ (error))
+
+(define (schedule-empty? schedule)
+ (eq? schedule '()))
+
+
+;;; Port handling
+