All summer and winter time is correctly generated. (Tested up to 2100)

This commit is contained in:
ollo 2016-04-17 16:16:17 +02:00
parent f6c675aae7
commit 58f8779cd1

View File

@ -29,13 +29,15 @@ function getLocalTime(year, month, day, hour, minutes, seconds,dow)
elseif ((month == 3 and day >= 25 and day <= 31 and hour > 2 and dow == 7) or
-- Only handle days after the last sunday in this month
((month == 3 and day >= 25 and day <= 31 and dow < 7 and ((7-dow + day) > 31))) ) then
-- set summer time
hour = hour + 1
-- October is not 100% Summer time, ending with the last sunday
elseif ((month == 10 and day >= 25 and day <= 31 and hour < 2 and dow == 7) or
elseif ((month == 10 and day >= 25 and day <= 31 and hour <= 2 and dow == 7) or
(month == 10 and day >= 25 and day <= 31 and dow < 7 and ((7-dow + day) <= 31)) or
-- Handle all days up to the 25. of october
(month == 10 and day < 25 )
)then
-- set summer time
hour = hour + 1
end
@ -72,4 +74,4 @@ function convertMonth(str)
else
return 0
end
end
end