From ab1bb9bddc9e54dd340fca3cfc22f7a31e068b78 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Thu, 30 Jun 2022 10:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正闰年算法 --- funcext/tvclib/utslvclauxiliary.tsf | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/funcext/tvclib/utslvclauxiliary.tsf b/funcext/tvclib/utslvclauxiliary.tsf index 5445bba..e878c06 100644 --- a/funcext/tvclib/utslvclauxiliary.tsf +++ b/funcext/tvclib/utslvclauxiliary.tsf @@ -2175,9 +2175,21 @@ begin xx := array(max(xx1[0],xx2[0]),min(xx1[1],xx2[1])); return 1; end -function getmonthdates(y,m); +function leapyear(y); //ÈòÄêÅÐ¶Ï +begin + if not(y mod 4) then + begin + if not(y mod 100) then + begin + return not(y mod 400); + end + return 1; + end + return 0; +end +function getmonthdates(y,m); //»ñµÃËùÔÚÔµÄÌìÊý begin - if m = 2 then return (not(y mod 4) and ( (y mod 100)))+ 28; + if m = 2 then return leapyear(y)+ 28; if m in array(1,3,5,7,8,10,12) then return 31; return 30; end