anchor.diff:                  ((nil) (with-output-to-string (s)
                            (call/stream s))))))))))
   
  -(defun compile-time-format (string)
  -  (let (writers)
  -    (labels ((parse (&key (start 0))
  -               (multiple-value-bind (ms me rs re)
  -                   (ppcre:scan *directive-regex* string :start start)
  -                 (if ms
  -                     (progn
  -                       (push
  -                        (writer (stream time)
  -                          (write-string string stream :start start :end ms))
  -                        writers)
  -                       (push (apply #'compile-directive
  -                                    (loop for s across rs
  -                                          for e across re
  -                                          collect (unless (= s e)
  -                                                    (subseq string s e))))
  -                             writers)
  -                       (parse :start me))
  -                     (push (writer (stream time)
  -                             (write-string string stream :start start))
  -                           writers)))))
  -      (parse))
  -    writers))
  +(defun make-time-formatter (format)
  +  (if (keywordp format)
  +      (ensure-gethash format
  +                      *compiled-time-formats*
  +                      (multiple-value-bind (f force-gmt)
  +                          (named-time-format format)
  +                        (make-time-formatter-1 f force-gmt)))
  +      (make-time-formatter-1 format nil)))
   
   (defparameter *directive-regex*
     (ppcre:create-scanner
  
positive.code:                                            &optional time tz
                                             &environment env)
    (if (constantp format env)
        `(let ((*default-timezone* ,tz))
           (format-time ,stream (load-time-value (make-time-formatter ,format))
                        ,@(when time (list time))))
        decline))
  
  (defmacro writer ((stream time) &body body)
    `(lambda (,stream ,time)
       (declare (stream ,stream) (timestamp ,time)
                (optimize speed) (ignorable ,stream ,time))
       ,@body))
  
  (defun make-time-formatter (format &aux (tz *default-timezone*))
    (if (keywordp format)
        (multiple-value-bind (f gmt)
            (named-time-format format)
          (setf format f)
          (if gmt (setf tz +utc-zone+))))
    (let ((writers (nreverse (flatten! (compile-time-format format)))))
      (lambda (stream &key (time (now)))
        (let ((*default-timezone* (expand-tz tz)))
          (labels ((call/stream (stream)
                     (dolist (writer writers)
                       (declare (function writer)
                                (optimize speed))
                       (funcall writer stream time))))
            (declare (inline call/stream))
            (if (streamp stream)
                (call/stream stream)
  
negative.code:         (null
           (error "~S is not a known directive" directive))
          (character
           (lambda (s ts)
             (declare (optimize speed) (stream s) (ignore ts))
             (write-char action s)))
          (string
           (compile-formatter action))
          (symbol
           (compile-flag flag width (symbol-function action)))))))
  