@@ -221,15 +221,15 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
221221P_TimeADTGetDatum (origentry -> upper )));
222222
223223/* 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 );
225225
226226intr = DatumGetIntervalP (DirectFunctionCall2 (
227227time_mi_time ,
228228P_TimeADTGetDatum (origentry -> lower ),
229229P_TimeADTGetDatum (newentry -> lower )));
230230
231231/* 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 );
233233
234234* result = 0.0 ;
235235
@@ -240,7 +240,7 @@ gbt_time_penalty(PG_FUNCTION_ARGS)
240240P_TimeADTGetDatum (origentry -> upper ),
241241P_TimeADTGetDatum (origentry -> lower )));
242242* 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 ))));
244244* result *= (FLT_MAX / (((GISTENTRY * )PG_GETARG_POINTER (0 ))-> rel -> rd_att -> natts + 1 ));
245245}
246246