From 85a2d90cffddae040dda3c7890caa522a7813884 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Fri, 15 Aug 2025 21:42:45 -0700 Subject: [PATCH] fix daylight --- modules/space.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/space.py b/modules/space.py index ae0a5d9..2834ef6 100644 --- a/modules/space.py +++ b/modules/space.py @@ -102,7 +102,8 @@ def get_sun(lat=0, lon=0): sun_data = "SunRise: " + sun_table['rise_time'] + "\nSet: " + sun_table['set_time'] sun_data += "\nDaylight: " + str((local_sunset - local_sunrise).seconds // 3600) + "h " + str(((local_sunset - local_sunrise).seconds // 60) % 60) + "m" - if local_sunset > datetime.now(): + + if sun_table['altitude'] > 0: sun_data += "\nRemaining: " + str((local_sunset - datetime.now()).seconds // 3600) + "h " + str(((local_sunset - datetime.now()).seconds // 60) % 60) + "m" sun_data += "\nAzimuth: " + str('{0:.2f}'.format(sun_table['azimuth'] * 180 / ephem.pi)) + "°"