From 2c0207b3eba31d54983bdf75830e0ee5d15cfcf8 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Thu, 3 Oct 2019 08:54:48 +0200 Subject: [PATCH] The permanent dark/light can only happen beyond the polar circles --- src/sun.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sun.c b/src/sun.c index b0a1ddb..1a37daa 100644 --- a/src/sun.c +++ b/src/sun.c @@ -99,11 +99,11 @@ uint32_t calcSunSet(int year, int month, int day, float latitude, uint32_t calcDaylight(int month, float latitude, uint32_t rise, uint32_t set) { if (set == 0 || rise == 0) { if (month < 4 || month > 9) { - if (latitude < 0) return 86400; - else return 0; + if (latitude <= -65.7) return 86400; + else if (latitude >= 65.7) return 0; } else { - if (latitude > 0) return 86400; - else return 0; + if (latitude >= 65.7) return 86400; + else if (latitude <= -65.7) return 0; } }