]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
One more fix to the new HH:MM:SS modifier. This time add some test
authordrh <drh@noemail.net>
Sun, 29 Feb 2004 01:08:17 +0000 (01:08 +0000)
committerdrh <drh@noemail.net>
Sun, 29 Feb 2004 01:08:17 +0000 (01:08 +0000)
procedures too. (CVS 1280)

FossilOrigin-Name: 7b3b8968ee9a5349dd6e9ae1e7a311bf8906607c

manifest
manifest.uuid
src/date.c
test/date.test

index d33e69ab2f9f5d2c2ec1062eef07195b6dcc3b2c..84d430532b45c0d0dfc0a1933da7cb12d56a113d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Try\sagain\sto\sget\sthe\sHH:MM:SS\smodifier\schange\sright...\s(CVS\s1279)
-D 2004-02-29T00:50:33
+C One\smore\sfix\sto\sthe\snew\sHH:MM:SS\smodifier.\s\sThis\stime\sadd\ssome\stest\nprocedures\stoo.\s(CVS\s1280)
+D 2004-02-29T01:08:18
 F Makefile.in afc6c0377773421633e592347097ad036eef6aeb
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -28,7 +28,7 @@ F src/btree.h 41cb3ff6ebc3f6da2d0a074e39ff8c7a2287469f
 F src/btree_rb.c 99feb3ff835106d018a483a1ce403e5cf9c718bc
 F src/build.c c8ab8b467d9a64254b0d4d42083f6313b3a980d1
 F src/copy.c 750e13828c3e4a293123e36aaa7cf0f22466248a
-F src/date.c 33a5267827347e106cef2fe001770b6911fcfa3d
+F src/date.c f055419d602bde622c70f831350b6b52f2235de0
 F src/delete.c 82001c74882319f94dab5f6b92a27311b31092ae
 F src/encode.c 9e70ea1e4e746f23f18180949e94f1bb1c2220d3
 F src/expr.c 95ea5d47d11b5085aaeeb77d60b17c2cba13383a
@@ -83,7 +83,7 @@ F test/capi2.test ec96e0e235d87b53cbaef3d8e3e0f8ccf32c71ca
 F test/conflict.test 0911bb2f079046914a6e9c3341b36658c4e2103e
 F test/copy.test f07ea8d60878da7a67416ab62f78e9706b9d3c45
 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
-F test/date.test 80cc84210b59af26e03ffa3f323bdeb5190a48dd
+F test/date.test aed5030482ebc02bd8d386c6c86a29f694ab068d
 F test/delete.test 92256384f1801760180ded129f7427884cf28886
 F test/expr.test c4cc292d601019c2f2ce95093caaa5d10284b105
 F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
@@ -188,7 +188,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 248b5500900bc8f401006aaa9b7dac090ae419fa
-R 9e6e50874a22e82686efa948b5530e0e
+P e20d51f94ed67b8864a435e5735f61f396662c21
+R f6cfaacb2696207417d341bc6d9eaa35
 U drh
-Z 6aabfeb88e3f40a15732ea64d28d35d1
+Z 78e3b4d83ccc7f48feaa7210a8b39c81
index 1a1a24941e96459f9931da461ecdb90c33fe29ca..37bb71dce7c362c746938d7c91e0438f759e176a 100644 (file)
@@ -1 +1 @@
-e20d51f94ed67b8864a435e5735f61f396662c21
\ No newline at end of file
+7b3b8968ee9a5349dd6e9ae1e7a311bf8906607c
\ No newline at end of file
index 7aba7bcfebc6e3400879c1f4ce0f3d38144b61c3..03b66add9e20900ae1c403261cf61766c8169a82 100644 (file)
@@ -16,7 +16,7 @@
 ** sqliteRegisterDateTimeFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: date.c,v 1.15 2004/02/29 00:50:33 drh Exp $
+** $Id: date.c,v 1.16 2004/02/29 01:08:18 drh Exp $
 **
 ** NOTES:
 **
@@ -579,13 +579,13 @@ static int parseModifier(const char *zMod, DateTime *p){
         memset(&tx, 0, sizeof(tx));
         if( parseHhMmSs(z2, &tx) ) break;
         computeJD(&tx);
-        computeJD(p);
-        clearYMD_HMS_TZ(p);
+        tx.rJD -= 0.5;
         day = (int)tx.rJD;
         tx.rJD -= day;
-        tx.rJD -= 0.5;
         if( z[0]=='-' ) tx.rJD = -tx.rJD;
-        p->rJD += tx.rJD;
+        computeJD(p);
+        clearYMD_HMS_TZ(p);
+       p->rJD += tx.rJD;
         rc = 0;
         break;
       }
index 617c76e4e8b3d1e9db56aca63fe95179ee8fa7c0..041a4f6c5ed0db0f83c3b584f07ed691467425a1 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing date and time functions.
 #
-# $Id: date.test,v 1.6 2004/02/21 03:28:18 drh Exp $
+# $Id: date.test,v 1.7 2004/02/29 01:08:18 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -211,5 +211,34 @@ datetest 9.5 {julianday(datetime(1000))} {1000}
 datetest 9.6 {julianday(datetime(10000))} {10000}
 datetest 9.7 {julianday(datetime(100000))} {100000}
 
+# datetime() with just an HH:MM:SS correctly inserts the date 2000-01-01.
+#
+datetest 10.1 {datetime('01:02:03')}  {2000-01-01 01:02:03}
+datetest 10.2 {date('01:02:03')}  {2000-01-01}
+datetest 10.3 {strftime('%Y-%m-%d %H:%M','01:02:03')} {2000-01-01 01:02}
+
+# Test the new HH:MM:SS modifier
+#
+datetest 11.1 {datetime('2004-02-28 20:00:00', '-01:20:30')} \
+   {2004-02-28 18:39:30}
+datetest 11.2 {datetime('2004-02-28 20:00:00', '+12:30:00')} \
+   {2004-02-29 08:30:00}
+datetest 11.3 {datetime('2004-02-28 20:00:00', '+12:30')} \
+   {2004-02-29 08:30:00}
+datetest 11.4 {datetime('2004-02-28 20:00:00', '12:30')} \
+   {2004-02-29 08:30:00}
+datetest 11.5 {datetime('2004-02-28 20:00:00', '-12:00')} \
+   {2004-02-28 08:00:00}
+datetest 11.6 {datetime('2004-02-28 20:00:00', '-12:01')} \
+   {2004-02-28 07:59:00}
+datetest 11.7 {datetime('2004-02-28 20:00:00', '-11:59')} \
+   {2004-02-28 08:01:00}
+datetest 11.8 {datetime('2004-02-28 20:00:00', '11:59')} \
+   {2004-02-29 07:59:00}
+datetest 11.9 {datetime('2004-02-28 20:00:00', '12:01')} \
+   {2004-02-29 08:01:00}
+
+
+
 
 finish_test