Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Allow time modifiers of the form HH:MM:SS.SSS with an option "+" or "-" prefix. The specified amount of time is added into the date-time begin modified. (CVS 1277) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
559002a52fe3c42fe71ffce364eff4a0 |
User & Date: | drh 2004-02-29 00:40:32.000 |
Context
2004-02-29
| ||
00:48 | Fix a bug in the HH:MM:SS modifier change that was just checked in. (CVS 1278) (check-in: 248b550090 user: drh tags: trunk) | |
00:40 | Allow time modifiers of the form HH:MM:SS.SSS with an option "+" or "-" prefix. The specified amount of time is added into the date-time begin modified. (CVS 1277) (check-in: 559002a52f user: drh tags: trunk) | |
00:11 | Fix some compiler warnings in LCC. The warnings did not indicate real problems. Ticket #634. Not all warnings in ticket #634 were fixed. (CVS 1276) (check-in: e97089b7df user: drh tags: trunk) | |
Changes
Changes to src/date.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** 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 ** sqliteRegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** 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 ** sqliteRegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** ** $Id: date.c,v 1.13 2004/02/29 00:40:32 drh Exp $ ** ** NOTES: ** ** 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. |
︙ | ︙ | |||
331 332 333 334 335 336 337 | /* ** Compute the Year, Month, and Day from the julian day number. */ static void computeYMD(DateTime *p){ int Z, A, B, C, D, E, X1; if( p->validYMD ) return; | > > > > > | | | | | | | | | | | > | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | /* ** Compute the Year, Month, and Day from the julian day number. */ static void computeYMD(DateTime *p){ int Z, A, B, C, D, E, X1; if( p->validYMD ) return; if( !p->validJD ){ p->Y = 2000; p->M = 1; p->D = 1; }else{ Z = p->rJD + 0.5; A = (Z - 1867216.25)/36524.25; A = Z + 1 + A - (A/4); B = A + 1524; C = (B - 122.1)/365.25; D = 365.25*C; E = (B-D)/30.6001; X1 = 30.6001*E; p->D = B - D - X1; p->M = E<14 ? E-1 : E-13; p->Y = p->M>2 ? C - 4716 : C - 4715; } p->validYMD = 1; } /* ** Compute the Hour, Minute, and Seconds from the julian day number. */ static void computeHMS(DateTime *p){ |
︙ | ︙ | |||
556 557 558 559 560 561 562 563 564 565 566 567 568 569 | case '5': case '6': case '7': case '8': case '9': { n = getValue(z, &r); if( n<=0 ) break; z += n; while( isspace(z[0]) ) z++; n = strlen(z); if( n>10 || n<3 ) break; if( z[n-1]=='s' ){ z[n-1] = 0; n--; } computeJD(p); rc = 0; | > > > > > > > > > > > > > > > > > > > | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | case '5': case '6': case '7': case '8': case '9': { n = getValue(z, &r); if( n<=0 ) break; if( z[n]==':' ){ /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the ** specified number of hours, minutes, seconds, and fractional seconds ** to the time. The ".FFF" may be omitted. The ":SS.FFF" may be ** omitted. */ const char *z2 = z; DateTime tx; int day; if( !isdigit(*z2) ) z2++; memset(&tx, 0, sizeof(tx)); if( parseHhMmSs(z2, &tx) ) break; computeJD(&tx); if( z[0]=='-' ) tx.rJD = -tx.rJD; day = (int)tx.rJD; p->rJD += tx.rJD - day; rc = 0; break; } z += n; while( isspace(z[0]) ) z++; n = strlen(z); if( n>10 || n<3 ) break; if( z[n-1]=='s' ){ z[n-1] = 0; n--; } computeJD(p); rc = 0; |
︙ | ︙ |