mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-07-30 08:08:15 -05:00
Fix leap-year computation in the 'last_mday' computation.
* src/engine/date.c: Fix the last-day-of-month computation for leap years. Need to use modulo, not divide. (Patch by Neil Williams. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10453 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -260,12 +260,12 @@ int gnc_date_my_last_mday (int month, int year)
|
||||
/* leap */ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
|
||||
|
||||
/* Is this a leap year? */
|
||||
if (year / 2000 == 0)
|
||||
if (year % 2000 == 0)
|
||||
is_leap = TRUE;
|
||||
else if (year / 400 == 0)
|
||||
else if (year % 400 == 0)
|
||||
is_leap = FALSE;
|
||||
else
|
||||
is_leap = (year / 4 == 0);
|
||||
is_leap = (year % 4 == 0);
|
||||
|
||||
return days_in_month[is_leap][month-1];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user