diff --git a/main.lua b/main.lua index 4d19599..9273e10 100644 --- a/main.lua +++ b/main.lua @@ -1,4 +1,7 @@ dofile("wlancfg.lua") +dofile("timecore.lua") + +timezoneoffset=1 -- Wait to be connect to the WiFi access point. tmr.alarm(0, 100, 1, function() @@ -11,7 +14,7 @@ tmr.alarm(0, 100, 1, function() print('IP: ',wifi.sta.getip()) --ptbtime1.ptb.de - sntp.sync('192.53.103.108', + sntp.sync('ptbtime1.ptb.de', function(sec,usec,server) print('sync', sec, usec, server) end, @@ -26,6 +29,8 @@ end) tmr.alarm(1, 1000, 1 ,function() sec, usec = rtctime.get() + time = getTime(sec, timezoneoffset) print("Time : " , sec) + print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second) end)