Skip to content
Snippets Groups Projects
Commit 8e11c79a authored by am0ebe's avatar am0ebe
Browse files

use utc time. add sunrise/fall for winter

parent dba36dcf
Branches master
No related merge requests found
...@@ -62,7 +62,7 @@ sunrise = 0 ...@@ -62,7 +62,7 @@ sunrise = 0
sunset = 0 sunset = 0
#datetime.now(timezone.utc) #create aware! #datetime.now(timezone.utc) #create aware!
#utcnow() / utcfromtimestamp() #utcnow() / utcfromtimestamp()
now = dt.now().replace(second=0, microsecond=0) # ignore seconds and microseconds now = dt.utcnow().replace(second=0, microsecond=0) # ignore seconds and microseconds
#mlx (idx is also dmx-byte value) #mlx (idx is also dmx-byte value)
moon = [ 1.409, moon = [ 1.409,
...@@ -229,9 +229,15 @@ def init(): ...@@ -229,9 +229,15 @@ def init():
elif( now.month == 8 or (now.month == 9 and now.day <= 15 )): elif( now.month == 8 or (now.month == 9 and now.day <= 15 )):
sunrise = 7 sunrise = 7
sunset = 20 sunset = 20
else: elif( now.month == 9 or (now.month == 10 and now.day < 25 )):
sunrise = 7 sunrise = 7
sunset = 19 sunset = 19
elif( now.month in [10,11,12,1] or now.month == 2 and now.day < 2 ):
sunrise = 8
sunset = 16
else:
sunrise = 8
sunset = 17
def isDay(): def isDay():
return ((now.hour >= sunrise) and (now.hour < sunset)) return ((now.hour >= sunrise) and (now.hour < sunset))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment