From a46b39a764d6ff089d33e92c83bb248e18b8503f Mon Sep 17 00:00:00 2001 From: Junichi Satoh Date: Fri, 17 Aug 2018 13:33:12 +0900 Subject: [PATCH] Fixed month_have_days(), wrong calculation for leap year. --- pandora_server/lib/PandoraFMS/Tools.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index 41bf481198..1758d79459 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -1278,16 +1278,16 @@ sub month_have_days($$) { if ( $year <= 1752 ) { # Note: Although September 1752 only had 19 days, # they were numbered 1,2,14..30! - if (1752 == $year && 9 == $month) { + if (1752 == $year && 8 == $month) { return 19; } - if (2 == $month && 0 == $year % 4) { + if (1 == $month && 0 == $year % 4) { return 29; } } else { #Check if Leap year - if (2 == $month && 0 == $year % 4 && 0 == $year%100 + if (1 == $month && 0 == $year % 4 && 0 == $year%100 || 0 == $year%400) { return 29; }