/ Check-in [47fee16b]
Login

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

Overview
Comment:Fix a date round-off problem in strftime(). Ticket #2153. (CVS 3575)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | version_2
Files: files | file ages | folders
SHA1: 47fee16ba9bd8ab2820fe97e89480528114825cd
User & Date: drh 2007-01-08 16:20:29
Context
2007-01-08
16:20
Fix a date round-off problem in strftime(). Ticket #2153. (CVS 3575) Leaf check-in: 47fee16b user: drh tags: version_2
13:43
Fix a round-off error in the %W conversion of strftime(). Ticket #2150. (CVS 3572) check-in: e6a18741 user: drh tags: version_2
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   ** sqliteRegisterDateTimeFunctions() found at the bottom of the file.
    17     17   ** All other code has file scope.
    18     18   **
    19         -** $Id: date.c,v 1.16.2.3 2007/01/08 13:43:38 drh Exp $
           19  +** $Id: date.c,v 1.16.2.4 2007/01/08 16:20:29 drh Exp $
    20     20   **
    21     21   ** NOTES:
    22     22   **
    23     23   ** SQLite processes all times and dates as Julian Day numbers.  The
    24     24   ** dates and times are stored as the number of days since noon
    25     25   ** in Greenwich on November 24, 4714 B.C. according to the Gregorian
    26     26   ** calendar system.
................................................................................
   822    822           case 'm':  sprintf(&z[j],"%02d",x.M); j+=2; break;
   823    823           case 'M':  sprintf(&z[j],"%02d",x.m); j+=2; break;
   824    824           case 's': {
   825    825             sprintf(&z[j],"%d",(int)((x.rJD-2440587.5)*86400.0 + 0.5));
   826    826             j += strlen(&z[j]);
   827    827             break;
   828    828           }
   829         -        case 'S':  sprintf(&z[j],"%02d",(int)(x.s+0.5)); j+=2; break;
          829  +        case 'S':  sprintf(&z[j],"%02d",(int)x.s); j+=2; break;
   830    830           case 'w':  z[j++] = (((int)(x.rJD+1.5)) % 7) + '0'; break;
   831    831           case 'Y':  sprintf(&z[j],"%04d",x.Y); j+=strlen(&z[j]); break;
   832    832           case '%':  z[j++] = '%'; break;
   833    833         }
   834    834       }
   835    835     }
   836    836     z[j] = 0;