anchor.diff:  (defun absolute-beats-to-timestamp (beats clock)
     "Convert a clock's number of beats to a timestamp. The result is only guaranteed to be accurate if it's greater than the clock's when-tempo-changed slot."
     (with-slots (timestamp-at-tempo when-tempo-changed) clock
  -    (local-time:timestamp+ timestamp-at-tempo (dur-time (- beats when-tempo-changed) (tempo clock)) :sec)))
  -
  -(defun absolute-beats-to-internal-time (beats clock)
  -  "Convert a clock's number of beats to an internal real time. The result is only guaranteed to be accurate if it's greater than the clock's when-tempo-changed slot."
  -  (with-slots (time-at-tempo when-tempo-changed) clock
  -    (+ time-at-tempo (* internal-time-units-per-second (dur-time (- beats when-tempo-changed) (tempo clock))))))
  +    (local-time:timestamp+ timestamp-at-tempo (truncate (* (dur-time (- beats when-tempo-changed) (tempo clock)) 1000000000)) :nsec)))
   
   (defun make-clock (&optional (tempo 1) tasks)
     "Create a clock. The clock automatically starts running in a new thread."
  
positive.code:    (tasks :initform nil :documentation "The list of tasks that are running on the clock.")
     (tasks-lock :initform (bt:make-lock) :documentation "The lock on the tasks to make the clock thread-safe.")
     (timestamp-at-tempo :initform (local-time:now) :documentation "The local-time timestamp when the tempo was last changed.")
     (time-at-tempo :initform (get-internal-real-time) :documentation "The internal real time when the tempo was last changed.")
     (when-tempo-changed :initform 0 :documentation "The number of beats on the clock when the tempo was last changed.")))
  
  (defmethod (setf tempo) (value (item clock))
  
negative.code:                  (if (and (numberp (get-event-value nv :tempo))
                            (plusp (get-event-value nv :tempo)))
                       (setf tempo (get-event-value nv :tempo)
                             timestamp-at-tempo (absolute-beats-to-timestamp beats clock)
                             when-tempo-changed beats)
                       (warn "Tempo change event ~a has invalid :tempo parameter; ignoring." nv)))
                  (:rest
                   nil)
                  (otherwise
                   (let* ((event (combine-events nv (event :timestamp-at-start (absolute-beats-to-timestamp (slot-value task 'next-time) clock))))
                          (backend (which-backend-for-event event)))
                     (if backend
                         (funcall (getf (getf *backends* backend) :play) event task)
                         (warn "No backend claims to handle ~s; skipping." nv)))))
                ;; play the next event from this task if it occurs before the clock's next "wakeup time"
                (unless (position type '(:tempo-change))
                  (incf (slot-value task 'next-time) (event-value nv :delta))
                  (when (< (slot-value task 'next-time) (+ beats granularity))
                    (clock-process-task task clock)))))
            ;; if the task is done with or isn't a pstream, we return it so it can be removed from the clock, else we return nil so nothing happens
  