projects
/
clsql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c4bc291
)
made parse datestring/timestring return the value instead of erroring if they have...
author
Russ Tyndall
<russ@acceleration.net>
Tue, 29 Sep 2009 21:49:37 +0000
(17:49 -0400)
committer
Russ Tyndall
<russ@acceleration.net>
Tue, 29 Sep 2009 21:49:37 +0000
(17:49 -0400)
sql/time.lisp
patch
|
blob
|
history
diff --git
a/sql/time.lisp
b/sql/time.lisp
index 4e8b6af25ce6c6128bc192d837b3952d25416746..18451939657468ce447b6070dc0095a41069cde2 100644
(file)
--- 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))
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)."
(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*
(defvar *iso-8601-duration-delimiters*