summaryrefslogtreecommitdiff
path: root/update_time.lua
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-02-26 09:41:31 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-02-26 09:41:31 -0500
commitf785313415cc0c2e18c931f837facb8a0ce3cb12 (patch)
tree09201a991fdfff3e75b1c1102237636e0fb6dff8 /update_time.lua
parentafc38622f3c4b65de7d09713dd40944e2dbc073d (diff)
downloadnodeMCU_rf_source_lmx2487-f785313415cc0c2e18c931f837facb8a0ce3cb12.tar.gz
nodeMCU_rf_source_lmx2487-f785313415cc0c2e18c931f837facb8a0ce3cb12.zip
cleanup, removed unused files
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()