/ Check-in [73fbac7c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:73fbac7cf7b61b23831f62b996fbdd358695b473
User & Date: drh 2008-03-19 20:18:28
Context
2008-03-19
20:42
Undefine the "isView" macro when compiling with SQLITE_OMIT_VIEW so that the macro does not interfer with subsequent modules in the amalgamation. (CVS 4888) check-in: a42caa8f user: drh tags: trunk
20:18
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) check-in: 73fbac7c user: drh tags: trunk
19:55
Update the loadable extension module to include recently added interfaces. (CVS 4886) check-in: bf1ceced user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/date.c.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
** This file contains the C functions that implement date and time
** functions for SQLite.  
**
** There is only one exported symbol in this file - the function
** 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 $
**
** SQLite processes all times and dates as Julian Day numbers.  The
** dates and times are stored as the number of days since noon
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
** calendar system. 
**
** 1970-01-01 00:00:00 is JD 2440587.5
................................................................................
static void currentTimeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  time_t t;
  char *zFormat = (char *)sqlite3_user_data(context);
  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

#ifdef HAVE_GMTIME_R
  {
    struct tm sNow;
    gmtime_r(&t, &sNow);
    strftime(zBuf, 20, zFormat, &sNow);
  }
#else







|







 







|
|
|
|
|
|
|
<
<
<
<
<







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
966
967
968
969
970
971
972
973
974
975
976
977
978
979





980
981
982
983
984
985
986
** This file contains the C functions that implement date and time
** functions for SQLite.  
**
** There is only one exported symbol in this file - the function
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $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
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
** calendar system. 
**
** 1970-01-01 00:00:00 is JD 2440587.5
................................................................................
static void currentTimeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  time_t t;
  char *zFormat = (char *)sqlite3_user_data(context);
  sqlite3_vfs *pVfs;
  double rT;
  char zBuf[20];

  pVfs = sqlite3_vfs_find(0);
  sqlite3OsCurrentTime(pVfs, &rT);
  t = 86400.0*(rT - 2440587.5) + 0.5;





#ifdef HAVE_GMTIME_R
  {
    struct tm sNow;
    gmtime_r(&t, &sNow);
    strftime(zBuf, 20, zFormat, &sNow);
  }
#else