X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Ftime.lisp;h=18451939657468ce447b6070dc0095a41069cde2;hb=1e8d22b3fdace44a45b6b0702da5587e136e2398;hp=4e8b6af25ce6c6128bc192d837b3952d25416746;hpb=3895690af1045315a82a216fabe312d1a7e67dc5;p=clsql.git diff --git a/sql/time.lisp b/sql/time.lisp index 4e8b6af..1845193 100644 --- a/sql/time.lisp +++ b/sql/time.lisp @@ -1206,17 +1206,21 @@ rules" timestring starts with P, read a duration; otherwise read an ISO 8601 formatted date string." (declare (ignore junk-allowed)) - (let ((string (subseq timestring start end))) - (if (char= (aref string 0) #\P) - (parse-iso-8601-duration string) - (parse-iso-8601-time string)))) + (if (typep timestring '(or wall-time date)) + timestring + (let ((string (subseq timestring start end))) + (if (char= (aref string 0) #\P) + (parse-iso-8601-duration string) + (parse-iso-8601-time string))))) (defun parse-datestring (datestring &key (start 0) end junk-allowed) "parse a ISO 8601 timestring and return the corresponding date. Will throw a hissy fit if the date string is a duration. Will ignore any precision beyond day (hour/min/sec/usec)." - (let ((parsed-value (parse-timestring datestring :start start :end end :junk-allowed junk-allowed))) - (ecase (type-of parsed-value) - (wall-time (%make-date :mjd (time-mjd parsed-value)))))) + (if (typep datestring '(or wall-time date)) + datestring + (let ((parsed-value (parse-timestring datestring :start start :end end :junk-allowed junk-allowed))) + (ecase (type-of parsed-value) + (wall-time (%make-date :mjd (time-mjd parsed-value))))))) (defvar *iso-8601-duration-delimiters*