This implements 4 new types: DT, DTZ, DTL, and DTLZ. They all read/write javascript's Date format, and handle the conversion for reading/writing internally, replacing the need of user code to handle them
The DT type is the well-known DATE_AND_TIME type of S7-300/400 PLCs, a 8-byte-wide field with BCD-encoded parts
The DTZ type is the same as the DT, but it expects that the timestamp is in UTC in the PLC (usually NOT the case)
The DTL type is the one seen on newer S7-1200/1500 PLCs, is 12-byte long and encodes the timestamp differently than the older DATE_AND_TIME
The DTLZ type is also the same as the DTL, but expecting the timestamp in UTC in the PLC
Note that a javascript's Date is always in UTC, and this can cause some confusion to someone not used to that (or even to these ones) :)
Had this code laying around since long time ago, but never had the time to properly implement and test it. This has been also requested on node-red-contrib-s7#55, and the needed changes there are also ready for shipping.
This implements 4 new types: DT, DTZ, DTL, and DTLZ. They all read/write javascript's
Date
format, and handle the conversion for reading/writing internally, replacing the need of user code to handle themThe DT type is the well-known DATE_AND_TIME type of S7-300/400 PLCs, a 8-byte-wide field with BCD-encoded parts
The DTZ type is the same as the DT, but it expects that the timestamp is in UTC in the PLC (usually NOT the case)
The DTL type is the one seen on newer S7-1200/1500 PLCs, is 12-byte long and encodes the timestamp differently than the older DATE_AND_TIME
The DTLZ type is also the same as the DTL, but expecting the timestamp in UTC in the PLC
Note that a javascript's
Date
is always in UTC, and this can cause some confusion to someone not used to that (or even to these ones) :)Had this code laying around since long time ago, but never had the time to properly implement and test it. This has been also requested on node-red-contrib-s7#55, and the needed changes there are also ready for shipping.
@plcpeople what do you think?