anchor.diff:                                (parse-integer datestr :start (1+ pos))))))))
                 0)))
       (with-decoded-timestamp (:nsec nsec :sec sec :minute minute :hour hour)
  -        (parse-timestring (subseq intervalstr (or date-time-separator-index 0)))
  -      (encode-interval :nsec nsec :sec (+ extra-sec sec) :minute minute :hour hour))))
  -
  -(defun format-interval (interval &key (omit-date-part-p nil) (omit-time-part-p nil)
  +        (parse-timestring (subseq durationstr (or date-time-separator-index 0)))
  +      (encode-duration :nsec nsec :sec (+ extra-sec sec) :minute minute :hour hour))))
  +
  +(defun format-duration (duration &key (omit-date-part-p nil) (omit-time-part-p nil)
                           (date-elements (if omit-date-part-p 0 2)) (time-elements (if omit-time-part-p 0 4))
                           (date-separator #\-) (time-separator #\:) (date-time-separator #\T))
     (multiple-value-bind (nsec usec msec second minute hour day week)
  -      (decode-interval interval)
  +      (decode-duration duration)
       (with-output-to-string (str nil :element-type 'base-char)
         (when (zerop week)
           (decf date-elements)
  
positive.code: (declaim (inline now today encode-duration format-rfc3339-timestring)
           (ftype (function * (values simple-base-string)) format-rfc3339-timestring)
           (ftype (function * (values simple-base-string)) format-timestring)
           (ftype (function * (values simple-base-string)) format-interval)
           (ftype (function * (values fixnum)) local-timezone)
           (ftype (function (timestamp) (values (integer 0 999999999) (integer 0 59) (integer 0 59) (integer 0 23)
                                                 (integer 1 31) (integer 1 12) (integer -1000000 1000000)
  
negative.code:                   (values nsec usec msec second minute hour day week))))))))))
  
  ;; TODO: factor out useful parts from split-timestring and refactor this code
  (defun parse-duration (durationstr &key (date-separator #\-) (date-time-separator #\T))
    (let* ((date-time-separator-index (position date-time-separator durationstr))
           (extra-sec
            (if date-time-separator-index
                (let ((datestr (subseq durationstr 0 date-time-separator-index)))
                  (* +seconds-per-day+
                     (multiple-value-bind (first-integer pos)
                         (parse-integer datestr :junk-allowed t)
  