-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
I think this may be the same as #29 but testing it, I couldn't exactly get the same reproduction. At issue is when I use this library on my Pi, I'm getting a sunset value from the day before, but sunrise is correct.
This little snippet reproduces the issue for me.
import time
from datetime import datetime
from suntime import Sun, SunTimeException
from dateutil import tz
latitude = 42.01
longitude = -87.98
sun = Sun(latitude, longitude)
def main():
while True:
now = datetime.now(tz.gettz('US/Central'))
ss = sun.get_sunset_time(at_date=now, time_zone=tz.gettz('US/Central'))
sr = sun.get_sunrise_time(at_date=now, time_zone=tz.gettz('US/Central'))
print("Now: {}, sr: {}, ss: {}".format(now, sr, ss))
time.sleep(1)
if __name__ == '__main__':
main()
which gives me the following results
Now: 2024-03-19 07:55:42.667241-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:43.670629-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:44.673976-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:45.677398-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:46.680704-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:47.684021-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:48.687425-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:49.690767-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:50.694099-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
Now: 2024-03-19 07:55:51.697491-05:00, sr: 2024-03-19 06:55:48-05:00, ss: 2024-03-18 19:03:36-05:00
The values returned are correct, but notice that sunset is yesterday, which doesn't make a lot of sense. This behavior is the same whether I use at_date or not.
Name: suntime
Version: 1.3.2
Summary: Simple sunset and sunrise time calculation python library
Home-page: https://github.com/SatAgro/suntime
Author: Krzysztof Stopa
Author-email: None
License: LGPLv3
Location: /home/pi/.local/lib/python3.9/site-packages
Requires: python-dateutil
Required-by:
serotonie, scholl, klapmalt, CristianCantoro, juan11iguel and 6 moreserotonie, kstopa and mmege
Metadata
Metadata
Assignees
Labels
No labels