diff --git a/manifest b/manifest index 3545b39310..ee6e3f269c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssome\scompiler\swarnings\sin\sLCC.\s\sThe\swarnings\sdid\snot\sindicate\sreal\nproblems.\s\sTicket\s#634.\s\sNot\sall\swarnings\sin\sticket\s#634\swere\sfixed.\s(CVS\s1276) -D 2004-02-29T00:11:31 +C Allow\stime\smodifiers\sof\sthe\sform\sHH:MM:SS.SSS\swith\san\soption\s"+"\sor\s"-"\nprefix.\s\sThe\sspecified\samount\sof\stime\sis\sadded\sinto\sthe\sdate-time\sbegin\nmodified.\s(CVS\s1277) +D 2004-02-29T00:40:32 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 3025642cee50d5c41aef4a22cbc41aa7e543c922 +F src/date.c 6cb69543021dfeef085c0b49086906b4e3d9dac4 F src/delete.c 82001c74882319f94dab5f6b92a27311b31092ae F src/encode.c 9e70ea1e4e746f23f18180949e94f1bb1c2220d3 F src/expr.c 95ea5d47d11b5085aaeeb77d60b17c2cba13383a @@ -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 cce5bbf49b0a30c40d24a559bc6cb4585dd9aea5 -R c1ab69a50c059587ef6df03a47d3a546 +P e97089b7df3e2fbfcf36062099d02ecb75e9a870 +R e43012c1435f7b87cb5af95eb1f1d59c U drh -Z 589d89131597903f1402420d403727ec +Z 25e5e801d04060bff00304ad2d736bd0 diff --git a/manifest.uuid b/manifest.uuid index 013bc00528..b5b10c2deb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e97089b7df3e2fbfcf36062099d02ecb75e9a870 \ No newline at end of file +559002a52fe3c42fe71ffce364eff4a036ae6b83 \ No newline at end of file diff --git a/src/date.c b/src/date.c index e7c438e619..81ff093523 100644 --- a/src/date.c +++ b/src/date.c @@ -16,7 +16,7 @@ ** sqliteRegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: date.c,v 1.12 2004/02/22 17:49:33 drh Exp $ +** $Id: date.c,v 1.13 2004/02/29 00:40:32 drh Exp $ ** ** NOTES: ** @@ -335,17 +335,23 @@ static int parseDateOrTime(const char *zDate, DateTime *p){ static void computeYMD(DateTime *p){ int Z, A, B, C, D, E, X1; if( p->validYMD ) return; - Z = p->rJD + 0.5; - A = (Z - 1867216.25)/36524.25; - A = Z + 1 + A - (A/4); - B = A + 1524; - C = (B - 122.1)/365.25; - D = 365.25*C; - E = (B-D)/30.6001; - X1 = 30.6001*E; - p->D = B - D - X1; - p->M = E<14 ? E-1 : E-13; - p->Y = p->M>2 ? C - 4716 : C - 4715; + if( !p->validJD ){ + p->Y = 2000; + p->M = 1; + p->D = 1; + }else{ + Z = p->rJD + 0.5; + A = (Z - 1867216.25)/36524.25; + A = Z + 1 + A - (A/4); + B = A + 1524; + C = (B - 122.1)/365.25; + D = 365.25*C; + E = (B-D)/30.6001; + X1 = 30.6001*E; + p->D = B - D - X1; + p->M = E<14 ? E-1 : E-13; + p->Y = p->M>2 ? C - 4716 : C - 4715; + } p->validYMD = 1; } @@ -560,6 +566,25 @@ static int parseModifier(const char *zMod, DateTime *p){ case '9': { n = getValue(z, &r); if( n<=0 ) break; + if( z[n]==':' ){ + /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the + ** specified number of hours, minutes, seconds, and fractional seconds + ** to the time. The ".FFF" may be omitted. The ":SS.FFF" may be + ** omitted. + */ + const char *z2 = z; + DateTime tx; + int day; + if( !isdigit(*z2) ) z2++; + memset(&tx, 0, sizeof(tx)); + if( parseHhMmSs(z2, &tx) ) break; + computeJD(&tx); + if( z[0]=='-' ) tx.rJD = -tx.rJD; + day = (int)tx.rJD; + p->rJD += tx.rJD - day; + rc = 0; + break; + } z += n; while( isspace(z[0]) ) z++; n = strlen(z);