Skip to content

Commit

Permalink
checkIfFirstRunSinceBoot code simplicity
Browse files Browse the repository at this point in the history
  • Loading branch information
interduo authored Jul 23, 2024
1 parent dffd5e1 commit 0945a09
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/LibreQoS.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,15 @@ def shellReturn(command):
return returnableString

def checkIfFirstRunSinceBoot():
if os.path.isfile("lastRun.txt"):
systemRunningSince = datetime.fromtimestamp(psutil.boot_time())
if !os.path.isfile("lastRun.txt") or systemRunningSince < lastRun:
with open("lastRun.txt", 'r') as file:
lastRun = datetime.strptime(file.read(), "%d-%b-%Y (%H:%M:%S.%f)")
systemRunningSince = datetime.fromtimestamp(psutil.boot_time())
if systemRunningSince > lastRun:
print("First time run since system boot.")
return True
else:
print("Not first time run since system boot.")
return False
else:
print("First time run since system boot.")
return True
print("Not first time run since system boot.")
return False

def clearPriorSettings(interfaceA, interfaceB):
if enable_actual_shell_commands():
Expand Down

0 comments on commit 0945a09

Please sign in to comment.