alexander-yakushev / awesomerc

My awesome configuration
39 stars 12 forks source link

Lustrous, sunset before sunrise. #3

Closed ghost closed 2 years ago

ghost commented 6 years ago

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

alexander-yakushev commented 6 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?

alexander-yakushev commented 6 years ago

The link in the comment is broken, but I think I found a working one: http://edwilliams.org/sunrise_sunset_algorithm.htm