summaryrefslogtreecommitdiff
path: root/update_time.lua
diff options
context:
space:
mode:
Diffstat (limited to 'update_time.lua')
-rw-r--r--update_time.lua32
1 files changed, 0 insertions, 32 deletions
diff --git a/update_time.lua b/update_time.lua
deleted file mode 100644
index a57217c..0000000
--- a/update_time.lua
+++ /dev/null
@@ -1,32 +0,0 @@
-function update_time()
- -- Update time
- -- note that rtctime.get() provided updates only if time was set at least once
- -- either with rtctime.set() or with sntp.sync() which sets it internally
- sec, usec = rtctime.get()
- local usingUptime=false;
- if ( sec <= 0) then
- sec = tmr.time(); -- uptime
- usingUptime = true;
- else
- sec = sec + uts_offset;
- end
-
- tm = rtctime.epoch2cal(sec)
- -- print(string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"]))
- if ( usingUptime ) then
- local days = math.floor(sec/86400)
- dstr = string.format("up %03d days", days)
- else
- dstr = string.format("%04d/%02d/%02d", tm["year"], tm["mon"], tm["day"])
- end
- tstr = string.format("%02d:%02d:%02d", tm["hour"], tm["min"], tm["sec"])
-
- time_tmr:start()
-end
-
--- set up timer for time update
-time_tmr=tmr.create()
-time_tmr:register(time_update_interval, tmr.ALARM_SEMI, function() update_time() end)
-
-print("--- Starting Time Updates ---")
-time_tmr:start()