cal: simplify leap year rule
Gregorian rule for leap years has been adopted by reformation in year 1782 (Calendar Act 1750), but all tools (date, SQL servers, etc. etc.) don't care about it and apply the new rule for all year -- including years before the reformation. It's better to be compatible with another tools than try to be perfect :-) Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1507271 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
e1b5a57f43
commit
b9bd8dc267
|
@ -531,13 +531,9 @@ int main(int argc, char **argv)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* leap year -- account for gregorian reformation in 1752 */
|
||||
static int leap_year(int32_t year)
|
||||
{
|
||||
if (year <= REFORMATION_YEAR)
|
||||
return !(year % 4);
|
||||
else
|
||||
return ( !(year % 4) && (year % 100) ) || !(year % 400);
|
||||
return ( !(year % 4) && (year % 100) ) || !(year % 400);
|
||||
}
|
||||
|
||||
static void init_monthnames(struct cal_control *ctl)
|
||||
|
|
Loading…
Reference in New Issue