mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 01:46:08 +00:00
UConv: correct leap year parameters
git-svn-id: https://svn.fhem.de/fhem/trunk@14137 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6f2bfcf73c
commit
6f93ed79e3
@ -850,13 +850,14 @@ sub IsLeapYear (;$) {
|
|||||||
# leap year. (Works for Julian calendar,
|
# leap year. (Works for Julian calendar,
|
||||||
# established in 1582)
|
# established in 1582)
|
||||||
|
|
||||||
my $year = shift;
|
my $y = shift;
|
||||||
if ( !$year || $year !~ /^[1-2]\d{3}$/ ) {
|
if ( !$year || $year !~ /^[1-2]\d{3}$/ ) {
|
||||||
my (
|
my (
|
||||||
$tsec, $tmin, $thour, $tmday, $tmon,
|
$sec, $min, $hour, $mday, $month,
|
||||||
$tyear, $twday, $tyday, $tisdst
|
$monthISO, $year, $week, $weekISO, $wday,
|
||||||
) = GetTimeinfo($year);
|
$wdayISO, $yday, $isdst
|
||||||
$year = $tyear + 1900;
|
) = GetCalendarInfo($y);
|
||||||
|
$y = $year;
|
||||||
}
|
}
|
||||||
|
|
||||||
# If $year is not evenly divisible by 4, it is
|
# If $year is not evenly divisible by 4, it is
|
||||||
@ -867,7 +868,7 @@ sub IsLeapYear (;$) {
|
|||||||
# If there is a remainder then $year is
|
# If there is a remainder then $year is
|
||||||
# not evenly divisible by 4.)
|
# not evenly divisible by 4.)
|
||||||
|
|
||||||
return 0 if $year % 4;
|
return 0 if $y % 4;
|
||||||
|
|
||||||
# At this point, we know $year is evenly divisible
|
# At this point, we know $year is evenly divisible
|
||||||
# by 4. Therefore, if it is not evenly
|
# by 4. Therefore, if it is not evenly
|
||||||
@ -875,7 +876,7 @@ sub IsLeapYear (;$) {
|
|||||||
# we return the value 1 and do no further
|
# we return the value 1 and do no further
|
||||||
# calculations in this subroutine.
|
# calculations in this subroutine.
|
||||||
|
|
||||||
return 1 if $year % 100;
|
return 1 if $y % 100;
|
||||||
|
|
||||||
# At this point, we know $year is evenly divisible
|
# At this point, we know $year is evenly divisible
|
||||||
# by 4 and also evenly divisible by 100. Therefore,
|
# by 4 and also evenly divisible by 100. Therefore,
|
||||||
@ -883,7 +884,7 @@ sub IsLeapYear (;$) {
|
|||||||
# not leap year -- we return the value 0 and do no
|
# not leap year -- we return the value 0 and do no
|
||||||
# further calculations in this subroutine.
|
# further calculations in this subroutine.
|
||||||
|
|
||||||
return 0 if $year % 400;
|
return 0 if $y % 400;
|
||||||
|
|
||||||
# Now we know $year is evenly divisible by 4, evenly
|
# Now we know $year is evenly divisible by 4, evenly
|
||||||
# divisible by 100, and evenly divisible by 400.
|
# divisible by 100, and evenly divisible by 400.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user