This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Is it sunrise or sunset with an offset?
#5
Hi Roger,

my version is a little more basic, what do you think :


Code:
-- answer if we have the sun shining
function sun_is_up()
  local longitude = *****
  local latitude = ****
  local now = os.date('*t')
  local now_calc = now.min + now.hour*60
  
  local sunrise, sunset = rscalc(latitude, longitude)
  
  local result = (now_calc>(sunrise)) and (now_calc<(sunset))
  return result
end

longitude and latitude are fixed and there is no offset.

For those who search for the timezone setting, it's in Utilities > Date and time

Matthieu
Reply


Messages In This Thread
RE: Is it sunrise or sunset with an offset? - by Matt - 13.07.2015, 20:21

Forum Jump: