From e807febbc20dc7979e4085cda4dbae1a44d9476e Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 6 Jan 2004 00:44:24 +0000 Subject: [PATCH] Add the sqlite_current_time variable for testing purposes. (CVS 1156) FossilOrigin-Name: 23fa407d50741bc0719259792398f28c1d0f12c2 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os.c | 16 +++++++++++++--- src/test1.c | 5 ++++- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 1d9a310a95..3e1d3c953a 100644 --- 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 diff --git a/manifest.uuid b/manifest.uuid index 987d505bcc..742ca464f7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -720b565e2d02344e4d38263f4995dfabc60c0860 \ No newline at end of file +23fa407d50741bc0719259792398f28c1d0f12c2 \ No newline at end of file diff --git a/src/os.c b/src/os.c index d877254a46..61eb21bf89 100644 --- 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; } diff --git a/src/test1.c b/src/test1.c index f77ceab01f..32896f8896 100644 --- a/src/test1.c +++ b/src/test1.c @@ -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; -- 2.47.2