gijzelaerr / python-snap7

A Python wrapper for the snap7 PLC communication library
http://python-snap7.readthedocs.org/
MIT License
650 stars 245 forks source link

snap7.util.DB_Row set_dtl #463

Closed gunaycomert closed 12 months ago

gunaycomert commented 1 year ago

when added "set_dtl" funtion in util

gunaycomert commented 1 year ago

def setdtl(bytearray: bytearray, byteindex: int, dt: datetime) -> bytearray: bytearray[0:2] = dt.year.tobytes(2, byteorder='big', signed=True) bytearray[2:3] = dt.month.tobytes(1, byteorder='big', signed=True) bytearray[3:4] = dt.day.tobytes(1, byteorder='big', signed=True) bytearray[4:5] = dt.isocalendar()[1].tobytes(1, byteorder='big', signed=True) bytearray[5:6] = dt.hour.tobytes(1, byteorder='big', signed=True) bytearray[6:7] = dt.minute.tobytes(1, byteorder='big', signed=True) bytearray[7:8] = dt.second.tobytes(1, byteorder='big', signed=True) bytearray[8:12] = dt.microsecond.tobytes(4, byteorder='big', signed=True) return bytearray

gijzelaerr commented 12 months ago

is this a bug?