All Tests are finished
This commit is contained in:
parent
dc95893249
commit
e2af5ba8f5
14
timecore.lua
14
timecore.lua
@ -25,8 +25,18 @@ function getLocalTime(year, month, day, hour, minutes, seconds,dow)
|
|||||||
-- we are in 100% in the summer time
|
-- we are in 100% in the summer time
|
||||||
if (month > 3 and month < 10) then
|
if (month > 3 and month < 10) then
|
||||||
hour = hour + 1
|
hour = hour + 1
|
||||||
-- October is not 100% Summer time
|
-- March is not 100% Summer time, only starting at the last sunday
|
||||||
--FIXME elseif (month == 10 and
|
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
|
||||||
|
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
|
||||||
|
(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
|
||||||
|
hour = hour + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return year, month, day, hour, minutes, seconds
|
return year, month, day, hour, minutes, seconds
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
dofile("../timecore.lua")
|
dofile("../timecore.lua")
|
||||||
|
|
||||||
function checkTime(yearIn, monthIn, dayIn, hourIn, minutesIn, secondsIn,dowIn, resultingHourDiff)
|
function checkTime(yearIn, monthIn, dayIn, hourIn, minutesIn, secondsIn,dowIn, resultingHourDiff)
|
||||||
year, month, day, hour, minutes, seconds = getLocalTime(yearIn, monthIn, dayIn, hourIn, minutesIn, secondsIn,dow)
|
year, month, day, hour, minutes, seconds = getLocalTime(yearIn, monthIn, dayIn, hourIn, minutesIn, secondsIn, dowIn)
|
||||||
|
|
||||||
if not (year == yearIn and monthIn == month and day == dayIn and hour == (hourIn + resultingHourDiff) and minutesIn == minutes and secondsIn == seconds ) then
|
if not (year == yearIn and monthIn == month and day == dayIn and hour == (hourIn + resultingHourDiff) and minutesIn == minutes and secondsIn == seconds ) then
|
||||||
print(yearIn .. "-" .. string.format("%0.2d", monthIn) .. "-" .. string.format("%0.2d", dayIn) .. " " .. string.format("%0.2d", hourIn) .. ":" .. string.format("%0.2d", minutesIn) .. ":" .. string.format("%0.2d", secondsIn) .. " not as expected GMT+" .. resultingHourDiff .. " but GMT+" .. (hour - hourIn) )
|
print(yearIn .. "-" .. string.format("%0.2d", monthIn) .. "-" .. string.format("%0.2d", dayIn) .. " " .. string.format("%0.2d", hourIn) .. ":" .. string.format("%0.2d", minutesIn) .. ":" .. string.format("%0.2d", secondsIn) .. " (" .. dowIn .. ".th dayOfWeek) not as expected GMT+" .. resultingHourDiff .. " but GMT+" .. (hour - hourIn) )
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
else
|
else
|
||||||
print(yearIn .. "-" .. string.format("%0.2d", monthIn) .. "-" .. string.format("%0.2d", dayIn) .. " " .. string.format("%0.2d", hourIn) .. ":" .. string.format("%0.2d", minutesIn) .. ":" .. string.format("%0.2d", secondsIn) .. " is GMT+" .. resultingHourDiff )
|
print(yearIn .. "-" .. string.format("%0.2d", monthIn) .. "-" .. string.format("%0.2d", dayIn) .. " " .. string.format("%0.2d", hourIn) .. ":" .. string.format("%0.2d", minutesIn) .. ":" .. string.format("%0.2d", secondsIn) .. " is GMT+" .. resultingHourDiff )
|
||||||
|
Loading…
Reference in New Issue
Block a user