mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-29 18:26:21 +02:00
RPI: fix sleep calculation by using the correct (utc) time
This commit is contained in:
parent
511b1455a3
commit
e148f89d0c
1 changed files with 1 additions and 1 deletions
|
@ -62,7 +62,7 @@ class SunsetHandler:
|
||||||
tomorrow = now + timedelta(days=1)
|
tomorrow = now + timedelta(days=1)
|
||||||
nextSunrise = self.suntimes.riseutc(tomorrow)
|
nextSunrise = self.suntimes.riseutc(tomorrow)
|
||||||
self.nextSunset = self.suntimes.setutc(tomorrow)
|
self.nextSunset = self.suntimes.setutc(tomorrow)
|
||||||
time_to_sleep = int((nextSunrise - datetime.now()).total_seconds())
|
time_to_sleep = int((nextSunrise - datetime.utcnow()).total_seconds())
|
||||||
logging.info (f'Waiting for sunrise at {nextSunrise} UTC ({time_to_sleep} seconds)')
|
logging.info (f'Waiting for sunrise at {nextSunrise} UTC ({time_to_sleep} seconds)')
|
||||||
if time_to_sleep > 0:
|
if time_to_sleep > 0:
|
||||||
time.sleep(time_to_sleep)
|
time.sleep(time_to_sleep)
|
||||||
|
|
Loading…
Add table
Reference in a new issue