mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
use epoch() instead of time()
This commit is contained in:
@ -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,
|
||||||
|
@ -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,
|
||||||
|
Reference in New Issue
Block a user