From: Jérôme Benoit Date: Sat, 14 Jan 2023 23:21:20 +0000 (+0100) Subject: Fix timestamping at OCPP firmware update command handling X-Git-Tag: v1.1.90~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2c7bdc61118232aae9c754edfe6f8528640781ae;p=e-mobility-charging-stations-simulator.git Fix timestamping at OCPP firmware update command handling Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 03eb83f8..f62e0ef0 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -956,7 +956,8 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer return OCPPConstants.OCPP_RESPONSE_EMPTY; } const retrieveDate = Utils.convertToDate(commandPayload.retrieveDate); - if (retrieveDate.getTime() <= Date.now()) { + const now = Date.now(); + if (retrieveDate.getTime() <= now) { this.asyncResource .runInAsyncScope( this.updateFirmware.bind(this) as ( @@ -974,7 +975,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer this.updateFirmware(chargingStation).catch(() => { /* Intentional */ }); - }, retrieveDate.getTime() - Date.now()); + }, retrieveDate.getTime() - now); } return OCPPConstants.OCPP_RESPONSE_EMPTY; }