datetime: Fix a thinko

We need to check if a year is a leap one *after* we increased it with
the given value, not before.
This commit is contained in:
Emmanuele Bassi 2010-08-25 23:08:18 +01:00
parent 026375b395
commit 08877ee0dc

View File

@ -357,6 +357,8 @@ g_date_time_add_dmy (GDateTime *datetime,
gint step, i;
const guint16 *max_days;
__year += years;
/* subtract one day for leap years */
if (GREGORIAN_LEAP (__year) && __month == 2)
{
@ -364,8 +366,6 @@ g_date_time_add_dmy (GDateTime *datetime,
__day -= 1;
}
__year += years;
/* add months */
step = months > 0 ? 1 : -1;
for (i = 0; i < ABS (months); i++)