[slime-cvs] CVS update: slime/ChangeLog slime/swank.lisp

Marco Baringer mbaringer at common-lisp.net
Sun Jul 24 15:30:50 UTC 2005


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv8282

Modified Files:
	ChangeLog swank.lisp 
Log Message:

Date: Sun Jul 24 17:30:46 2005
Author: mbaringer

Index: slime/ChangeLog
diff -u slime/ChangeLog:1.724 slime/ChangeLog:1.725
--- slime/ChangeLog:1.724	Fri Jul 22 12:53:11 2005
+++ slime/ChangeLog	Sun Jul 24 17:30:46 2005
@@ -1,3 +1,10 @@
+2005-07-24  Tom Pierce <tlpierce at gmail.com>
+
+	* swank.lisp (format-iso8601-time): New functions. Properly
+	formats a universal-time as an iso8601 string.
+	(inspect-for-emacs integer): Use the new
+	format-iso8601 function when printing an integer as a date.
+	
 2005-07-22  Marco Baringer  <mb at bese.it>
 
 	* swank-openmcl.lisp (frame-catch-tags): Remove some debugging


Index: slime/swank.lisp
diff -u slime/swank.lisp:1.309 slime/swank.lisp:1.310
--- slime/swank.lisp:1.309	Tue Jun 21 20:28:58 2005
+++ slime/swank.lisp	Sun Jul 24 17:30:46 2005
@@ -3659,6 +3659,26 @@
   (declare (ignore inspector))
   (values "A number." `("Value: " ,(princ-to-string n))))
 
+(defun format-iso8601-time (time-value &optional include-timezone-p)
+    "Formats a universal time TIME-VALUE in ISO 8601 format, with
+    the time zone included if INCLUDE-TIMEZONE-P is non-NIL"    
+    ;; Taken from http://www.pvv.ntnu.no/~nsaa/ISO8601.html
+    ;; Thanks, Nikolai Sandved and Thomas Russ!
+    (flet ((format-iso8601-timezone (zone)
+             (if (zerop zone)
+                 "Z"
+                 (multiple-value-bind (h m) (truncate (abs zone) 1.0)
+                   ;; Tricky.  Sign of time zone is reversed in ISO 8601
+                   ;; relative to Common Lisp convention!
+                   (format nil "~:[+~;-~]~2,'0D:~2,'0D"
+                           (> zone 0) h (round m))))))
+    (multiple-value-bind (second minute hour day month year dow dst zone)
+      (decode-universal-time time-value)
+      (declare (ignore dow dst))
+      (format nil "~4,'0D-~2,'0D-~2,'0DT~2,'0D:~2,'0D:~2,'0D~:[~*~;~A~]"
+              year month day hour minute second
+              include-timezone-p (format-iso8601-timezone zone)))))
+
 (defmethod inspect-for-emacs ((i integer) inspector)
   (declare (ignore inspector))
   (values "A number."
@@ -3671,10 +3691,7 @@
            (label-value-line "Length" (integer-length i))
            (ignore-errors
              (list "As time: " 
-                   (multiple-value-bind (sec min hour date month year)
-                       (decode-universal-time i)
-                     (format nil "~4,'0D-~2,'0D-~2,'0DT~2,'0D:~2,'0D:~2,'0DZ"
-                             year month date hour min sec)))))))
+                   (format-iso8601-time i t))))))
 
 (defmethod inspect-for-emacs ((c complex) inspector)
   (declare (ignore inspector))




More information about the slime-cvs mailing list