Skip to content

Commit

Permalink
Merge pull request #273 from flying-sheep/fix-suntime
Browse files Browse the repository at this point in the history
Fix compatibility with suntime 1.3
  • Loading branch information
l0drex authored Mar 11, 2024
2 parents 572ba65 + eb5d16c commit ad5cebd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
psutil==5.9.7
PySide6==6.6.1
PySide6-Addons==6.6.1
suntime==1.2.5
suntime>=1.3.1
systemd-python==235
requests~=2.31.0
6 changes: 4 additions & 2 deletions yin_yang/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pathlib
from abc import ABC, abstractmethod
from datetime import time
from dateutil import tz
from functools import cache
from typing import Union, Optional

Expand Down Expand Up @@ -103,9 +104,10 @@ def get_sun_time(latitude, longitude) -> tuple[time, time]:
logger.debug(f'Calculating sunset and sunrise at location {latitude}, {longitude}.')

sun = Sun(latitude, longitude)
local_tz = tz.gettz()
try:
today_sr = sun.get_local_sunrise_time()
today_ss = sun.get_local_sunset_time()
today_sr = sun.get_sunrise_time(time_zone=local_tz)
today_ss = sun.get_sunset_time(time_zone=local_tz)

return today_sr.time(), today_ss.time()

Expand Down

0 comments on commit ad5cebd

Please sign in to comment.