Browse Source

Merge pull request #371 from fred777/main

fix rare crash related to time shift which might cause negative sleep time
pull/361/head
Lukas Pusch 2 years ago
committed by GitHub
parent
commit
9403335545
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      tools/rpi/hoymiles/__main__.py

6
tools/rpi/hoymiles/__main__.py

@ -322,8 +322,10 @@ if __name__ == '__main__':
print('', end='', flush=True)
if loop_interval > 0 and (time.time() - t_loop_start) < loop_interval:
time.sleep(loop_interval - (time.time() - t_loop_start))
time_to_sleep = loop_interval - (time.time() - t_loop_start)
if loop_interval > 0 and time_to_sleep > 0:
time.sleep(time_to_sleep)
except KeyboardInterrupt:
sys.exit()

Loading…
Cancel
Save