Advertisement
DamagedDolphin

Time check doesn't work

Apr 24th, 2020
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. import time
  2.  
  3. quietStart = 23
  4. quietEnd = 9
  5.  
  6. def nightCheck():
  7.     currentHour = int(time.strftime('%H'))
  8.     if quietEnd > quietStart:
  9.         if quietStart > currentHour and quietEnd < currentHour:
  10.             return(True)
  11.         else:
  12.             return(False)
  13.     elif quietEnd < quietStart:
  14.         if quietStart >= currentHour and quietEnd > currentHour:
  15.             return(True)
  16.         else:
  17.             return(False)
  18. nightMode = nightCheck()
  19.  
  20. print(nightMode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement