Open menesesc opened 4 years ago
hi,
The year decode has calculation problem. In /pyzatt/misc.py#L78 https://github.com/adrobinoga/pyzatt/blob/dc30714ed641388f53537319f6c0e7bd8dba544a/pyzatt/misc.py#L78 you can replace the number 2000 with 1999 as a work around.
year = int((enc_t / (3600. * 24.)) / 365) + 2000 # year
There is another way to fix timestamp calculation. I found out that the pyzk package use a better timestamp calculation. You need to remove codes in lines of 72 to 78 inside /pyzatt/misc.py
enc_t = struct.unpack('<I', enc_t_arr)[0] # extracts the time value
secs = int(enc_t % 60) # seconds
mins = int((enc_t / 60.) % 60) # minutes
hour = int((enc_t / 3600.) % 24) # hours
day = int(((enc_t / (3600. * 24.)) % 31)) + 1 # day
month = int(((enc_t / (3600. * 24. * 31.)) % 12)) + 1 # month
year = int((enc_t / (3600. * 24.)) / 365) + 2000 # year
and add the following there
secs = enc_t % 60
enc_t = enc_t // 60
mins = enc_t % 60
enc_t = enc_t // 60
hour = enc_t % 24
enc_t = enc_t // 24
day = enc_t % 31 + 1
enc_t = enc_t // 31
month = enc_t % 12 + 1
enc_t = enc_t // 12
year = enc_t + 2000
@odoo-app-dev good suggestion, thank you. You saved my day
Description
Hi Alexander! I use a iFace302. When try read_att_log show me an incorrect datetime attendance: 2021-08-26 23:08:49 (now is 2020!). On terminal screen the date is correct. One more... is possible add a workcode/incidence in this function? when download the attendance log to pendrive on the terminal, get a .dat file with this value on the last colum:
id - att datetime - terminalnumber - ? - ? - workcode 200 2020-08-26 23:08:49 7 0 1 53
What I Did
zk.read_att_log()
Thank you from Argentina