/ Check-in [51b3bfc3]
Login

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

Overview
Comment:Do not use long long constants in code. Ticket #3547. (CVS 6048)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 51b3bfc3b9628ca4ec754fa7f23aef7302f890ff
User & Date: drh 2008-12-20 13:18:50
Context
2008-12-20
18:33
Add a vfs backend that detects problems like the one addressed by (6043) and (6047). (CVS 6049) check-in: 49172e48 user: danielk1977 tags: trunk
13:18
Do not use long long constants in code. Ticket #3547. (CVS 6048) check-in: 51b3bfc3 user: drh tags: trunk
08:39
Fix the crash-followed-by-corruption bug revealed by savepoint4.test. This is actually the same bug as was fixed by (6043). The fix was not entirely correct. (CVS 6047) check-in: 68833626 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/date.c.

    12     12   ** This file contains the C functions that implement date and time
    13     13   ** functions for SQLite.  
    14     14   **
    15     15   ** There is only one exported symbol in this file - the function
    16     16   ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
    17     17   ** All other code has file scope.
    18     18   **
    19         -** $Id: date.c,v 1.98 2008/12/10 22:30:25 shane Exp $
           19  +** $Id: date.c,v 1.99 2008/12/20 13:18:50 drh Exp $
    20     20   **
    21     21   ** SQLite processes all times and dates as Julian Day numbers.  The
    22     22   ** dates and times are stored as the number of days since noon
    23     23   ** in Greenwich on November 24, 4714 B.C. according to the Gregorian
    24     24   ** calendar system. 
    25     25   **
    26     26   ** 1970-01-01 00:00:00 is JD 2440587.5
................................................................................
   444    444     } else {
   445    445       int s = (int)(x.s + 0.5);
   446    446       x.s = s;
   447    447     }
   448    448     x.tz = 0;
   449    449     x.validJD = 0;
   450    450     computeJD(&x);
   451         -  t = x.iJD/1000 - 210866760000LL;
          451  +  t = x.iJD/1000 - 21086676*(i64)10000;
   452    452   #ifdef HAVE_LOCALTIME_R
   453    453     {
   454    454       struct tm sLocal;
   455    455       localtime_r(&t, &sLocal);
   456    456       y.Y = sLocal.tm_year + 1900;
   457    457       y.M = sLocal.tm_mon + 1;
   458    458       y.D = sLocal.tm_mday;
................................................................................
   546    546         /*
   547    547         **    unixepoch
   548    548         **
   549    549         ** Treat the current value of p->iJD as the number of
   550    550         ** seconds since 1970.  Convert to a real julian day number.
   551    551         */
   552    552         if( strcmp(z, "unixepoch")==0 && p->validJD ){
   553         -        p->iJD = p->iJD/86400 + 210866760000000LL;
          553  +        p->iJD = p->iJD/86400 + 21086676*(i64)10000000;
   554    554           clearYMD_HMS_TZ(p);
   555    555           rc = 0;
   556    556         }
   557    557   #ifndef SQLITE_OMIT_LOCALTIME
   558    558         else if( strcmp(z, "utc")==0 ){
   559    559           sqlite3_int64 c1;
   560    560           computeJD(p);