Closed ghost closed 2 years ago
Hi, @magnjo
To be honest, I never investigated the algorithm too carefully, I just ported it to Lua. Could it be that longitude has to be positive? Maybe it's in range 0-360 and not -180-+180?
The link in the comment is broken, but I think I found a working one: http://edwilliams.org/sunrise_sunset_algorithm.htm
Not sure if I use lustrous.lua wrong but in this case I get sunset the day before sunrise.
local _, phoenix_rise, phoenix_set = lustrous.get_time({ lat = 33.61, lon = -112.41 }) print (os.date("!%c", phoenix_rise), os.date("!%c", phoenix_set))
Sat Sep 22 11:17:00 2018 Fri Sep 21 23:26:00 2018