From: Kevin Rosenberg Date: Thu, 10 Dec 2009 14:15:30 +0000 (-0700) Subject: Fix to SYNTAX-PARSE-ISO-8601 to parse fractions of seconds X-Git-Tag: v4.2.0~2 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=c81a9fe27ee259429b89ef680788abb8f8e1b26a Fix to SYNTAX-PARSE-ISO-8601 to parse fractions of seconds --- diff --git a/ChangeLog b/ChangeLog index a741db9..4e59172 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +10 Dec 2009 Kevin Rosenberg + * sql/time.lisp: Patch from Oleg Tihonov to SYNTAX-PARSE-ISO-8601 + to properly parse fractions of seconds. + 10 Dec 2009 Kevin Rosenberg * sql/time.lisp: Patch from Oleg Tihonov to roll function to properly use USEC argument. diff --git a/sql/time.lisp b/sql/time.lisp index 554bc17..66731c1 100644 --- a/sql/time.lisp +++ b/sql/time.lisp @@ -1315,16 +1315,18 @@ Will throw a hissy fit if the date string is a duration. Will ignore any precisi (char= #\. (char string 19)))) (multiple-value-bind (parsed-usec usec-end) (parse-integer string :start 20 :junk-allowed t) - (setf usec (or parsed-usec 0) - gmt-sec-offset (if (<= (+ 3 usec-end) strlen) - (let ((skip-to (or (position #\+ string :start 19) - (position #\- string :start 19)))) - (if skip-to - (* 60 60 - (parse-integer string :start skip-to - :end (+ skip-to 3))) - 0)) - 0)))) + (let ((parsed-usec (and parsed-usec + (floor (* parsed-usec (expt 10 (+ 6 (- usec-end) 20))))))) + (setf usec (or parsed-usec 0) + gmt-sec-offset (if (<= (+ 3 usec-end) strlen) + (let ((skip-to (or (position #\+ string :start 19) + (position #\- string :start 19)))) + (if skip-to + (* 60 60 + (parse-integer string :start skip-to + :end (+ skip-to 3))) + 0)) + 0))))) (t (setf usec 0 gmt-sec-offset (if (<= 22 strlen)