From 58f8779cd1bc79489b3a590625849cf3960428d6 Mon Sep 17 00:00:00 2001 From: ollo Date: Sun, 17 Apr 2016 16:16:17 +0200 Subject: [PATCH] All summer and winter time is correctly generated. (Tested up to 2100) --- timecore.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/timecore.lua b/timecore.lua index 59772bf..013ffc1 100644 --- a/timecore.lua +++ b/timecore.lua @@ -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 \ No newline at end of file +end