]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the sqlite_current_time variable for testing purposes. (CVS 1156)
authordrh <drh@noemail.net>
Tue, 6 Jan 2004 00:44:24 +0000 (00:44 +0000)
committerdrh <drh@noemail.net>
Tue, 6 Jan 2004 00:44:24 +0000 (00:44 +0000)
FossilOrigin-Name: 23fa407d50741bc0719259792398f28c1d0f12c2

manifest
manifest.uuid
src/os.c
src/test1.c

index 1d9a310a95b7f45ca2b400838a24ee22d59567cc..3e1d3c953ac25246ea9611c4fa52d44f64baf30c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C The\s"EST"\stimezone\sdesignation\sis\sambiguous.\s\sDo\snot\suse\sit\sin\sthe\stest\nscripts.\s(CVS\s1155)
-D 2004-01-02T15:08:43
+C Add\sthe\ssqlite_current_time\svariable\sfor\stesting\spurposes.\s(CVS\s1156)
+D 2004-01-06T00:44:25
 F Makefile.in 0515ff9218ad8d5a8f6220f0494b8ef94c67013b
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -38,7 +38,7 @@ F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
 F src/insert.c 01f66866f35c986eab4a57373ca689a3255ef2df
 F src/main.c 3dd3cae00bade294011da5a3cf9ff660a610c545
 F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
-F src/os.c 0412e9832d1727b1372314dbff32a3afe5bd50ae
+F src/os.c d5a13117cebbef36a5e986783d0a144afc5df7d1
 F src/os.h 4101ce267c2f5c8a34914e6af122e97907fcb205
 F src/pager.c ca24fced1ca4c2b8ea519d5fe8ec69a2d846276f
 F src/pager.h 5da62c83443f26b1792cfd72c96c422f91aadd31
@@ -53,7 +53,7 @@ F src/sqlite.h.in e6cfff01fafc8a82ce82cd8c932af421dc9adb54
 F src/sqliteInt.h a70744a84caec6d48017143ea5b9f945867e539e
 F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895
 F src/tclsqlite.c dcd18d1f0d51ac4863d1f9059f614f903bc1fffe
-F src/test1.c 169f662965e1130b4119e4b68ca7fb19fb3be993
+F src/test1.c 1d297ca6c01601ee38d723ff08343dc01f351985
 F src/test2.c 5014337d8576b731cce5b5a14bec4f0daf432700
 F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
 F src/test4.c dcbbbb382626fd466a7c46907f74db35fc8bad64
@@ -179,7 +179,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
 F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
-P 7080fc39eaf98ef7a7d1c1819603f67841f35c72
-R 0f5d0d37504b0cee41bd734f6a13351f
+P 720b565e2d02344e4d38263f4995dfabc60c0860
+R f8de8a215a694e6aa8ad957d7bf6a945
 U drh
-Z 48676305f403b742abf6f64db5e2f91e
+Z 4f7ef24347116d6ebacdd3903fd02b08
index 987d505bcc9dd2f8c518e30134229a7fae3e6fdc..742ca464f7de82ae8c8fb69196e70dd894a94d26 100644 (file)
@@ -1 +1 @@
-720b565e2d02344e4d38263f4995dfabc60c0860
\ No newline at end of file
+23fa407d50741bc0719259792398f28c1d0f12c2
\ No newline at end of file
index d877254a46d9e50a3431fbb6b8a210fac242619d..61eb21bf8943f0a19a9ac7834495922c2cd1dd06 100644 (file)
--- a/src/os.c
+++ b/src/os.c
@@ -1616,6 +1616,14 @@ char *sqliteOsFullPathname(const char *zRelative){
 #endif
 }
 
+/*
+** The following variable, if set to a now-zero value, become the result
+** returned from sqliteOsCurrentTime().  This is used for testing.
+*/
+#ifdef SQLITE_TEST
+int sqlite_current_time = 0;
+#endif
+
 /*
 ** Find the current time (in Universal Coordinated Time).  Write the
 ** current time and date as a Julian Day number into *prNow and
@@ -1626,7 +1634,6 @@ int sqliteOsCurrentTime(double *prNow){
   time_t t;
   time(&t);
   *prNow = t/86400.0 + 2440587.5;
-  return 0;
 #endif
 #if OS_WIN
   FILETIME ft;
@@ -1637,8 +1644,11 @@ int sqliteOsCurrentTime(double *prNow){
   GetSystemTimeAsFileTime( &ft );
   now = ((double)ft.dwHighDateTime) * 4294967296.0; 
   *prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
+#endif
+#ifdef SQLITE_TEST
+  if( sqlite_current_time ){
+    *prNow = sqlite_current_time/86400.0 + 2440587.5;
+  }
 #endif
   return 0;
-
-  return 1;
 }
index f77ceab01fa915f15863c15e0be83a676c2ba486..32896f8896c5bc78acf52cfb939d42fceeed082f 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.30 2003/12/23 03:06:23 drh Exp $
+** $Id: test1.c,v 1.31 2004/01/06 00:44:25 drh Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -887,6 +887,7 @@ static int test_breakpoint(
 int Sqlitetest1_Init(Tcl_Interp *interp){
   extern int sqlite_search_count;
   extern int sqlite_open_file_count;
+  extern int sqlite_current_time;
   static struct {
      char *zName;
      Tcl_CmdProc *xProc;
@@ -925,6 +926,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
       (char*)&sqlite_search_count, TCL_LINK_INT);
   Tcl_LinkVar(interp, "sqlite_open_file_count", 
       (char*)&sqlite_open_file_count, TCL_LINK_INT);
+  Tcl_LinkVar(interp, "sqlite_current_time", 
+      (char*)&sqlite_current_time, TCL_LINK_INT);
   Tcl_LinkVar(interp, "sqlite_static_bind_value",
       (char*)&sqlite_static_bind_value, TCL_LINK_STRING);
   return TCL_OK;