From 4810985a54477d1d145026c484129f29d53b9705 Mon Sep 17 00:00:00 2001 From: ollo Date: Fri, 30 Dec 2016 14:16:19 +0100 Subject: [PATCH] Handle uninitialized constants --- main.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index 49d6c98..61c92e6 100644 --- a/main.lua +++ b/main.lua @@ -42,8 +42,11 @@ function syncTimeFromInternet() end function displayTime() - sec, usec = rtctime.get() - + sec, usec = rtctime.get() + -- Handle lazy programmer: + if (timezoneoffset == nil) then + timezoneoffset=0 + end time = getTime(sec, timezoneoffset) print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second) words = display_timestat(time.hour, time.minute) @@ -110,8 +113,8 @@ function normalOperation() tmr.alarm(2, 500, 0 ,function() syncTimeFromInternet() end) - print("Start webserver...") tmr.alarm(3, 2000, 0 ,function() + print("Start webserver...") mydofile("webserver") startWebServer() end)