From 9dd895ef2d84cad05cb7c53fd56e34619dfcead6 Mon Sep 17 00:00:00 2001 From: Sven Hoexter Date: Thu, 3 Feb 2022 21:23:54 +0100 Subject: [PATCH] Fix exit code for location-date combinations without sunrise/sunset. --- weblogpro/suntime.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weblogpro/suntime.lua b/weblogpro/suntime.lua index fc65166..9e46a0b 100755 --- a/weblogpro/suntime.lua +++ b/weblogpro/suntime.lua @@ -58,7 +58,7 @@ function daysInMonth(year, month) end --[[ Ported from https://pypi.org/project/suntime/ - which is based on https://stackoverflow.com/questions/19615350/calculate-sunrise-and-sunset-times-for-a-given-gps-coordinate-within-postgresql + which is based on https://stackoverflow.com/questions/19615350/ which took the algorithm from https://web.archive.org/web/20161022214335/https://williams.best.vwh.net/sunrise_sunset_algorithm.htm year: number @@ -118,11 +118,11 @@ function calc_sun_time(year, month, day, lon, lat, getRiseTime) if(cosH > 1) then -- return None -- The sun never rises on this location (on the specified date) print("Sun will never rise here and now.") - os.exit() + os.exit(1) elseif(cosH < -1) then -- return None -- The sun never sets on this location (on the specified date) print("Sun will never rise here and now.") - os.exit() + os.exit(0) end -- 7b. finish calculating H and convert into hours -- 2.39.2