Account for invalid time values properly.

This commit is contained in:
Himanshu Goel 2023-10-09 14:24:31 -04:00
parent a68470a344
commit 4fdc11952e

View file

@ -206,7 +206,7 @@ def main():
for key in defaults: for key in defaults:
if key not in cfg_tmp: if key not in cfg_tmp:
cfg_tmp[key] = defaults[key] cfg_tmp[key] = defaults[key]
if cfg_tmp['last_run_time'] == -1: if cfg_tmp['last_run_time'] == -1 or cfg_tmp['last_run_time'] > time.time() + 60 * 60: # If last run time is in the future, set it to 1 hour ago
cfg_tmp['last_run_time'] = time.time() - 60 * 60 cfg_tmp['last_run_time'] = time.time() - 60 * 60
if cfg_tmp['last_run_time'] != -1 and time.time() - cfg_tmp['last_run_time'] < 60 * 60: if cfg_tmp['last_run_time'] != -1 and time.time() - cfg_tmp['last_run_time'] < 60 * 60: