mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-07 00:01:49 -04:00
more intuitive leap year check
This commit is contained in:
parent
24bb9fdbf7
commit
5020a456c0
@ -381,8 +381,8 @@ time_t asn1_to_time(const chunk_t *utctime, asn1_t type)
|
|||||||
tm_leap = tm_leap_4 - tm_leap_100 + tm_leap_400 - tm_leap_1970;
|
tm_leap = tm_leap_4 - tm_leap_100 + tm_leap_400 - tm_leap_1970;
|
||||||
|
|
||||||
/* if date later then February, is the current year a leap year? */
|
/* if date later then February, is the current year a leap year? */
|
||||||
if ((tm_mon > 1 && 4*(tm_leap_4 + 1) == tm_year) &&
|
if (tm_mon > 1 && (tm_year % 4 == 0) &&
|
||||||
(100*(tm_leap_100 + 1) != tm_year || 400*(tm_leap_400 + 1) == tm_year))
|
(tm_year % 100 != 0 || tm_year % 400 == 0))
|
||||||
{
|
{
|
||||||
tm_leap++;
|
tm_leap++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user