Closed vthielen closed 3 years ago
Pleas keep in mind, that python 2.7 is dead platform and it is unlikely, that bugs related to it will be fixed.
When running with python 3, library uses time.monotonic()
, which does not have this issue.
Next release of Minimalmodbus will only support Python3, and there is time.monotonic()
available.
When I set the Linux system clock for the first time after system startup (meaning there might be a big jump, because clock before was uninitialized) the library suddenly seems to 'hang' on the next modbus operation. Some debugging reveals that there is a sleep that times some operation by subtracting two system times. This means that the sleep time is equal to the clock jump, and could becomes days, months... I temporarily changed the code to limit max sleep to 1 sec (I guess that should be enough en all cases), but if I ever have to reinstall/ upgrade the lib I will have to debug the same problem (I have very limited memory for old problems). Is it possible to correct this in the official version of the lib?
On line 1337 of /usr/local/lib/python2.7/minimalmodbus/dist-packages/minimalmodbus.py in the original version there is:
I changed this into :