-C Fix\stwo\s-Werror=lto-type-mismatch\swarnings\sreported\sin\s[forum:ef62b57bd5|forum\spost\sef62b57bd5].
-D 2024-02-29T10:55:02.008
+C Proof-of-concept\sfor\snew\stime-interval\soperator\s"pg-month"\sand\s"pg-year"\sthat\nuse\sthe\struncate-to-month\salgorithm\sfor\smonth\soverflow\sinstead\sof\sthe\nwrap-to-next-month\salgorithm\sthat\sis\sused\sby\sSQLite\sby\sdefault.
+D 2024-03-02T13:38:46.691
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b
-F src/date.c 90df32c2d8b2a38dd2e83d32e47802629305c4882fb2ec75c9ecdcd75b68bcb2
+F src/date.c f0bde50092368a0eaff79e25ab24c3c91763859adffd91af6bf47cbc13cc7512
F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782
F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43
F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d51c699ae413215d534f954c129691ef5d95d540dc5d4304cbba576c976d931c 29f94610dc8319709b8d3726a60e2a7a33ffbf4998c681f772da26c9701cc0b0
-R 728f9a968510fa9cb95ea7ce7eec45f1
-T +closed 29f94610dc8319709b8d3726a60e2a7a33ffbf4998c681f772da26c9701cc0b0 Closed\sby\sintegrate-merge.
-U stephan
-Z 37dee8fa6539319388e07ab4c515c697
+P 803481f25020f3c25941f1e7d1a8071937820dea951e8798198b0b0fa3fb48ce
+R 736136842d7746223f17212059cfe765
+T *branch * month-truncate
+T *sym-month-truncate *
+T -sym-trunk *
+U drh
+Z e1892067371eb0569faf26bcf07d7955
# Remove this line to create a well-formed Fossil manifest.
*/
static const struct {
u8 nName; /* Length of the name */
- char zName[7]; /* Name of the transformation */
+ char zName[9]; /* Name of the transformation */
float rLimit; /* Maximum NNN value for this transform */
float rXform; /* Constant used for this transform */
} aXformType[] = {
- { 6, "second", 4.6427e+14, 1.0 },
- { 6, "minute", 7.7379e+12, 60.0 },
- { 4, "hour", 1.2897e+11, 3600.0 },
- { 3, "day", 5373485.0, 86400.0 },
- { 5, "month", 176546.0, 2592000.0 },
- { 4, "year", 14713.0, 31536000.0 },
+ { 6, "second", 4.6427e+14, 1.0 },
+ { 6, "minute", 7.7379e+12, 60.0 },
+ { 4, "hour", 1.2897e+11, 3600.0 },
+ { 3, "day", 5373485.0, 86400.0 },
+ { 5, "month", 176546.0, 2592000.0 },
+ { 4, "year", 14713.0, 31536000.0 },
+ { 8, "pg-month", 176546.0, 2592000.0 },
+ { 7, "pg-year", 14713.0, 31536000.0 },
};
/*
&& sqlite3_strnicmp(aXformType[i].zName, z, n)==0
&& r>-aXformType[i].rLimit && r<aXformType[i].rLimit
){
+ int targetMonth = 0;
switch( i ){
+ case 6:
case 4: { /* Special processing to add months */
- assert( strcmp(aXformType[i].zName,"month")==0 );
+ assert( strcmp(aXformType[i].zName,"month")==0
+ || strcmp(aXformType[i].zName,"pg-month")==0 );
computeYMD_HMS(p);
p->M += (int)r;
x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
p->Y += x;
p->M -= x*12;
+ assert( p->M>=1 && p->M<=12 );
+ if( i==6 ) targetMonth = p->M;
p->validJD = 0;
r -= (int)r;
break;
}
+ case 7:
case 5: { /* Special processing to add years */
int y = (int)r;
- assert( strcmp(aXformType[i].zName,"year")==0 );
+ assert( strcmp(aXformType[i].zName,"year")==0
+ || strcmp(aXformType[i].zName,"pg-year")==0 );
computeYMD_HMS(p);
+ assert( p->M>=1 && p->M<=12 );
+ if( i==7 ) targetMonth = p->M;
p->Y += y;
p->validJD = 0;
r -= (int)r;
}
}
computeJD(p);
+ if( targetMonth>0 ){
+ p->validYMD = 0;
+ computeYMD(p);
+ if( p->M==targetMonth+1 ) p->iJD -= p->D*86400000;
+ p->validYMD = 0;
+ }
p->iJD += (sqlite3_int64)(r*1000.0*aXformType[i].rXform + rRounder);
rc = 0;
break;