X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-time.lisp;h=39cc93061bfe5e59520480a82f6bb3022e0e3c23;hb=f8a3685cf1911b090510f22eaa0734fb16d3fdb2;hp=5d2e2e580992bc2cc3a24a912ce751532ee842e0;hpb=24fade3a91cc98a4a08509de1893f21ec37f8ebe;p=clsql.git diff --git a/tests/test-time.lisp b/tests/test-time.lisp index 5d2e2e5..39cc930 100644 --- a/tests/test-time.lisp +++ b/tests/test-time.lisp @@ -69,6 +69,25 @@ (decode-time time1)) 3 32 56 14 23 1 2010 6) +(deftest :time/print-parse/1 + ;;make sure when we print and parse we get the same time. + (let* ((time (clsql-sys:make-time :year 2010 :month 1 :day 4 + :hour 14 :minute 15 :second 44)) + (string-time (iso-timestring time)) + (time2 (parse-timestring string-time))) + (decode-time time2)) + 0 44 15 14 4 1 2010 1) + +(deftest :time/print-parse/2 + ;;make sure when we print and parse we get the same time. + (let* ((time (clsql-sys:make-time :year 2010 :month 1 :day 4 + :hour 14 :minute 15 :second 44 :usec 3)) + (string-time (iso-timestring time)) + (time2 (parse-timestring string-time))) + (decode-time time2)) + 3 44 15 14 4 1 2010 1) + + ;; relations of intervals (deftest :time/1 (let* ((time-1 (clsql:parse-timestring "2002-01-01 10:00:00")) @@ -273,17 +292,6 @@ t) -(deftest :time/14-usec - ;;make sure when we print and parse we get the same time. - (let* ((time (clsql-sys:make-time :year 2010 :month 1 :day 4 - :hour 14 :minute 15 :second 44 :usec 3)) - (string-time (clsql-sys:format-time nil time :format :iso)) - (time2 (clsql-sys:parse-timestring string-time))) - (format-time nil time2 :format :iso)) - #.(format-time nil (clsql-sys:make-time :year 2010 :month 1 :day 4 - :hour 14 :minute 15 :second 44 :usec 3) - :format :iso)) - ;;; The cross platform dataset uses the 'timestamp' column type which is ;;; in sql-92, for all that means. @@ -316,6 +324,22 @@ ))) #.(format-time nil (parse-timestring "2008-09-09T14:37:29-04:00") :format :iso)) +;;;This test gets at the databases that only support miliseconds, +;;; not microseconds. +(deftest :time/cross-platform/msec + (with-dataset *cross-platform-datetest* + (let ((time (parse-timestring "2008-09-09T14:37:29.423"))) + (clsql-sys:insert-records :into [datetest] + :attributes '([testtime]) + :values (list time)) + (let ((testtime + (first (clsql:select [testtime] + :from [datetest] :flatp T + :where [= [testtime] time] )))) + (format-time nil (parse-timestring testtime) :format :iso) + ))) + #.(format-time nil (parse-timestring "2008-09-09T14:37:29.423") :format :iso)) + (deftest :time/cross-platform/usec/no-tz (with-dataset *cross-platform-datetest* (let ((time (parse-timestring "2008-09-09T14:37:29.000213")))