diff --git a/reactor-plc/plc.lua b/reactor-plc/plc.lua index 6f9622d..f0f00b1 100644 --- a/reactor-plc/plc.lua +++ b/reactor-plc/plc.lua @@ -282,7 +282,7 @@ function comms_init(id, modem, local_port, server_port, reactor, iss) -- keep alive ack 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 -- 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 -- keep alive request received, echo back local timestamp = packet.data[1] - local trip_time = os.time() - timestamp + local trip_time = os.epoch() - timestamp if trip_time < 0 then 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 local sys_status = { - os.time(), + os.epoch(), (not self.scrammed), overridden, degraded, diff --git a/scada-common/alarm.lua b/scada-common/alarm.lua index b93df73..d6670a4 100644 --- a/scada-common/alarm.lua +++ b/scada-common/alarm.lua @@ -9,7 +9,7 @@ SEVERITY = { function scada_alarm(severity, device, message) local self = { - time = os.time(), + time = os.epoch(), ts_string = os.date("[%H:%M:%S]"), severity = severity, device = device,