1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Use the xCurrentTime method of the default VFS instead of stdlib time() to

get the current time when compiling with SQLITE_OMIT_DATETIME_FUNCS. (CVS 4887)

FossilOrigin-Name: 73fbac7cf7b61b23831f62b996fbdd358695b473
This commit is contained in:
drh
2008-03-19 20:18:27 +00:00
parent e5dd20a6ac
commit 8257f0c1da
3 changed files with 13 additions and 18 deletions

View File

@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: date.c,v 1.76 2008/02/21 20:40:44 drh Exp $
** $Id: date.c,v 1.77 2008/03/19 20:18:28 drh Exp $
**
** SQLite processes all times and dates as Julian Day numbers. The
** dates and times are stored as the number of days since noon
@@ -970,18 +970,13 @@ static void currentTimeFunc(
){
time_t t;
char *zFormat = (char *)sqlite3_user_data(context);
sqlite3_vfs *pVfs;
double rT;
char zBuf[20];
time(&t);
#ifdef SQLITE_TEST
{
extern int sqlite3_current_time; /* See os_XXX.c */
if( sqlite3_current_time ){
t = sqlite3_current_time;
}
}
#endif
pVfs = sqlite3_vfs_find(0);
sqlite3OsCurrentTime(pVfs, &rT);
t = 86400.0*(rT - 2440587.5) + 0.5;
#ifdef HAVE_GMTIME_R
{
struct tm sNow;