From: drh Date: Wed, 25 Feb 2009 19:07:24 +0000 (+0000) Subject: Move the new genfkey shell command out from within #ifdef _WIN32_ (CVS 6327) X-Git-Tag: version-3.6.15~423 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da10822a61207d89ed8ed157ddc80b0a0917bb3c;p=thirdparty%2Fsqlite.git Move the new genfkey shell command out from within #ifdef _WIN32_ (CVS 6327) FossilOrigin-Name: 48ee0e47e2d9669cc7425104e6b04ce49caf2e56 --- diff --git a/manifest b/manifest index b8a76ad338..26dc9b36a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sgenfkey.c.\sChange\sgenfkey.README\sto\stalk\sabout\sthe\snew\sshell\sdot-command,\snot\sthe\sold\sstandalone\sgenfkey\sprogram.\s(CVS\s6326) -D 2009-02-25T15:43:57 +C Move\sthe\snew\sgenfkey\sshell\scommand\sout\sfrom\swithin\s#ifdef\s_WIN32_\s(CVS\s6327) +D 2009-02-25T19:07:25 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in d64baddbf55cdf33ff030e14da837324711a4ef7 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -155,7 +155,7 @@ F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628 F src/resolve.c dea005135845acbbfae1f2968c0deb6b2e3d580c F src/rowset.c ba9375f37053d422dd76965a9c370a13b6e1aac4 F src/select.c 4d0b77fd76ff80f09a798ee98953e344c9de8fbb -F src/shell.c 6ffbdb812a75f736fc5cd0fc9ec4fd82663f196c +F src/shell.c 0cada72035b819ed2bede27e254efcfbb88167f7 F src/sqlite.h.in 14f4d065bafed8500ea558a75a8e2be89c784d61 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 F src/sqliteInt.h e717d30828600865b8f74456fd461e6a52ead6df @@ -701,7 +701,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 0a59fb28b46e5d85c850d1dfa1385a4656e4dda5 -R 3c98ede20378321f5af46ceb07590363 -U danielk1977 -Z e2cf6f9602002a2636a92e6c95e07c27 +P 36d699660bc328e65170d72be715338e82dbbb50 +R 7f42e226ab2b746ac50fedc5f267f111 +U drh +Z 46bbb2602043845ae8e84b264be6c003 diff --git a/manifest.uuid b/manifest.uuid index e24fd1ac9b..4f7ea804a3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -36d699660bc328e65170d72be715338e82dbbb50 \ No newline at end of file +48ee0e47e2d9669cc7425104e6b04ce49caf2e56 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 73742fc9b2..35be1b3cbc 100644 --- a/src/shell.c +++ b/src/shell.c @@ -12,7 +12,7 @@ ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** -** $Id: shell.c,v 1.203 2009/02/25 15:43:57 danielk1977 Exp $ +** $Id: shell.c,v 1.204 2009/02/25 19:07:25 drh Exp $ */ #if defined(_WIN32) || defined(WIN32) /* This needs to come before any includes for MSVC compiler */ @@ -73,6 +73,48 @@ extern int isatty(); #include #include +/* Saved resource information for the beginning of an operation */ +static struct rusage sBegin; + +/* True if the timer is enabled */ +static int enableTimer = 0; + +/* +** Begin timing an operation +*/ +static void beginTimer(void){ + if( enableTimer ){ + getrusage(RUSAGE_SELF, &sBegin); + } +} + +/* Return the difference of two time_structs in seconds */ +static double timeDiff(struct timeval *pStart, struct timeval *pEnd){ + return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + + (double)(pEnd->tv_sec - pStart->tv_sec); +} + +/* +** Print the timing results. +*/ +static void endTimer(void){ + if( enableTimer ){ + struct rusage sEnd; + getrusage(RUSAGE_SELF, &sEnd); + printf("CPU Time: user %f sys %f\n", + timeDiff(&sBegin.ru_utime, &sEnd.ru_utime), + timeDiff(&sBegin.ru_stime, &sEnd.ru_stime)); + } +} +#define BEGIN_TIMER beginTimer() +#define END_TIMER endTimer() +#define HAS_TIMER 1 +#else +#define BEGIN_TIMER +#define END_TIMER +#define HAS_TIMER 0 +#endif + /************************************************************************** *************************************************************************** @@ -913,48 +955,6 @@ genfkey_exit: /*************************************************************************/ /*************************************************************************/ -/* Saved resource information for the beginning of an operation */ -static struct rusage sBegin; - -/* True if the timer is enabled */ -static int enableTimer = 0; - -/* -** Begin timing an operation -*/ -static void beginTimer(void){ - if( enableTimer ){ - getrusage(RUSAGE_SELF, &sBegin); - } -} - -/* Return the difference of two time_structs in seconds */ -static double timeDiff(struct timeval *pStart, struct timeval *pEnd){ - return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + - (double)(pEnd->tv_sec - pStart->tv_sec); -} - -/* -** Print the timing results. -*/ -static void endTimer(void){ - if( enableTimer ){ - struct rusage sEnd; - getrusage(RUSAGE_SELF, &sEnd); - printf("CPU Time: user %f sys %f\n", - timeDiff(&sBegin.ru_utime, &sEnd.ru_utime), - timeDiff(&sBegin.ru_stime, &sEnd.ru_stime)); - } -} -#define BEGIN_TIMER beginTimer() -#define END_TIMER endTimer() -#define HAS_TIMER 1 -#else -#define BEGIN_TIMER -#define END_TIMER -#define HAS_TIMER 0 -#endif - /* ** Used to prevent warnings about unused parameters */