princ time patch

Alan Shields <[email protected]> Mon, 24 Oct 2005 14:29:31 -0500
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
I kinda like it when princ doesn't produce #<...> output, so I added
support for that.

Hope this is useful for others,
Alan

--- time.lisp.old	2005-10-24 13:49:36.000000000 -0500
+++ time.lisp	2005-10-24 13:55:42.000000000 -0500
@@ -67,7 +67,9 @@
 
 (defun %print-wall-time (time stream depth)
   (declare (ignore depth))
-  (format stream "#<WALL-TIME: ~a>" (format-time nil time)))
+  (if *print-escape*
+      (format stream "#<WALL-TIME: ~a>" (format-time nil time))
+      (format-time stream time :format :pretty)))
 
 (defstruct (duration (:constructor %make-duration)
                      (:print-function %print-duration))
@@ -81,8 +83,10 @@
 
 (defun %print-duration (duration stream depth)
   (declare (ignore depth))
-  (format stream "#<DURATION: ~a>"
-          (format-duration nil duration :precision :second)))
+  (if *print-escape*
+      (format stream "#<DURATION: ~a>"
+	      (format-duration nil duration :precision :second))
+      (format-duration stream duration :precision :second)))
 
 (defstruct (date (:constructor %make-date)
 		 (:print-function %print-date))
@@ -90,7 +94,9 @@
 
 (defun %print-date (date stream depth)
   (declare (ignore depth))
-  (format stream "#<DATE: ~a>" (format-date nil date)))
+  (if *print-escape*
+      (format stream "#<DATE: ~a>" (format-date nil date))
+      (format-date stream date :format :pretty)))
 
 );eval-when