mirror of
https://github.com/holub/mame
synced 2025-07-01 00:09:18 +03:00
Simplified coreutil.c gregorian_days_in_month. [William Krick]
This commit is contained in:
parent
0bb208ce12
commit
377168c4b4
@ -82,12 +82,11 @@ int gregorian_is_leap_year(int year)
|
|||||||
|
|
||||||
int gregorian_days_in_month(int month, int year)
|
int gregorian_days_in_month(int month, int year)
|
||||||
{
|
{
|
||||||
if (month == 2)
|
assert(month >= 1 && month <= 12)
|
||||||
return gregorian_is_leap_year(year) ? 29 : 28;
|
|
||||||
else if (month == 4 || month == 6 || month == 9 || month == 11)
|
int days[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
|
||||||
return 30;
|
days[1] += gregorian_is_leap_year(year) ? 1 : 0;
|
||||||
else
|
return days[month-1];
|
||||||
return 31;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user