@@ -221,15 +221,15 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
221
221
P_TimeADTGetDatum (origentry -> upper )));
222
222
223
223
/* see interval_larger */
224
- res = Max (intr -> time + intr -> month * (30 * 86400 ),0 );
224
+ res = Max (intr -> time + intr -> day * 86400 + intr -> month * (30 * 86400 ),0 );
225
225
226
226
intr = DatumGetIntervalP (DirectFunctionCall2 (
227
227
time_mi_time ,
228
228
P_TimeADTGetDatum (origentry -> lower ),
229
229
P_TimeADTGetDatum (newentry -> lower )));
230
230
231
231
/* see interval_larger */
232
- res += Max (intr -> time + intr -> month * (30 * 86400 ),0 );
232
+ res += Max (intr -> time + intr -> day * 86400 + intr -> month * (30 * 86400 ),0 );
233
233
234
234
* result = 0.0 ;
235
235
@@ -240,7 +240,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
240
240
P_TimeADTGetDatum (origentry -> upper ),
241
241
P_TimeADTGetDatum (origentry -> lower )));
242
242
* result += FLT_MIN ;
243
- * result += (float ) (res / ((double ) (res + intr -> time + intr -> month * (30 * 86400 ))));
243
+ * result += (float ) (res / ((double ) (res + intr -> time + intr -> day * 86400 + intr -> month * (30 * 86400 ))));
244
244
* result *= (FLT_MAX / (((GISTENTRY * )PG_GETARG_POINTER (0 ))-> rel -> rd_att -> natts + 1 ));
245
245
}
246
246