use epoch() instead of time()

This commit is contained in:
Mikayla Fischler
2022-04-23 11:54:09 -04:00
parent cd289ffb1e
commit 812d10f374
2 changed files with 4 additions and 4 deletions

View File

@ -282,7 +282,7 @@ function comms_init(id, modem, local_port, server_port, reactor, iss)
-- keep alive ack -- keep alive ack
local _send_keep_alive_ack = function (srv_time) local _send_keep_alive_ack = function (srv_time)
_send(RPLC_TYPES.KEEP_ALIVE, { srv_time, os.time() }) _send(RPLC_TYPES.KEEP_ALIVE, { srv_time, os.epoch() })
end end
-- general ack -- general ack
@ -368,7 +368,7 @@ function comms_init(id, modem, local_port, server_port, reactor, iss)
if packet.type == RPLC_TYPES.KEEP_ALIVE then if packet.type == RPLC_TYPES.KEEP_ALIVE then
-- keep alive request received, echo back -- keep alive request received, echo back
local timestamp = packet.data[1] local timestamp = packet.data[1]
local trip_time = os.time() - timestamp local trip_time = os.epoch() - timestamp
if trip_time < 0 then if trip_time < 0 then
log._warning("PLC KEEP_ALIVE trip time less than 0 (" .. trip_time .. ")") log._warning("PLC KEEP_ALIVE trip time less than 0 (" .. trip_time .. ")")
@ -490,7 +490,7 @@ function comms_init(id, modem, local_port, server_port, reactor, iss)
end end
local sys_status = { local sys_status = {
os.time(), os.epoch(),
(not self.scrammed), (not self.scrammed),
overridden, overridden,
degraded, degraded,

View File

@ -9,7 +9,7 @@ SEVERITY = {
function scada_alarm(severity, device, message) function scada_alarm(severity, device, message)
local self = { local self = {
time = os.time(), time = os.epoch(),
ts_string = os.date("[%H:%M:%S]"), ts_string = os.date("[%H:%M:%S]"),
severity = severity, severity = severity,
device = device, device = device,