diff options
author | drh <drh@noemail.net> | 2005-08-29 23:00:03 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2005-08-29 23:00:03 +0000 |
commit | 19e2d37f1de2459dad62416124c26cdaa84e82db (patch) | |
tree | b158f590be274fb7ff16ddb4c9cda790ec8c3c87 /src/os_unix.c | |
parent | b46b57745ddf0d131843e229fc13a3dbc231f545 (diff) | |
download | sqlite-19e2d37f1de2459dad62416124c26cdaa84e82db.tar.gz sqlite-19e2d37f1de2459dad62416124c26cdaa84e82db.zip |
Increase resolution of time-of-day on unix. Add an experimental
sqlite3_profile() API. (CVS 2639)
FossilOrigin-Name: ed2ca0873fa89d6cfd123541d5d1c6b92c72b6ab
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 2ea9aa8e3..836d01fab 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -18,6 +18,7 @@ #include <time.h> +#include <sys/time.h> #include <errno.h> #include <unistd.h> @@ -1420,9 +1421,16 @@ int sqlite3_current_time = 0; ** return 0. Return 1 if the time and date cannot be found. */ int sqlite3OsCurrentTime(double *prNow){ +#ifdef NO_GETTOD time_t t; time(&t); *prNow = t/86400.0 + 2440587.5; +#else + struct timeval sNow; + struct timezone sTz; /* Not used */ + gettimeofday(&sNow, &sTz); + *prNow = 2440587.5 + sNow.tv_sec/86400.0 + sNow.tv_usec/86400000000.0; +#endif #ifdef SQLITE_TEST if( sqlite3_current_time ){ *prNow = sqlite3_current_time/86400.0 + 2440587.5; |