Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone 4 calculate Day Duration programmatically from GPS latitude and day of the year

I'm looking at this wikipedia article:

  • http://en.wikipedia.org/wiki/Day_length

  • http://en.wikipedia.org/wiki/Sunrise_equation

Anybody had experience calculating Sunrise/Sunset times on iOS using the equations above with latitude given by the GPS?

I'm also interested in the Solar Noon. The idea is to create a clock in which the sun revolves around a fixed button, indicating time in a truly "analog" sense... The Sunrise/sunset times would then allow me to position the orbit of the "sun" around the button for a given day of the year, giving the impression of how much daylight time there will be, and how much has already expired.

Somehow iPhone adjusts brightness automatically, do you know if that is based on the ambient light via light sensor or some kind of calculation like the one that I'm trying to do above? Maybe there's already something out there that I can use?

Thank you, I'm sure this information will benefit not just me!

I found this source in C++, but am not sure how to integrate it into an existing Xcode project. http://www.sci.fi/~benefon/rscalc_cpp.html

like image 541
Alex Stone Avatar asked Oct 06 '11 23:10

Alex Stone


1 Answers

Here is a objective-c framework to calculate sunrise and sunset based on the location.

The iPhone adjusts its brightness by a sensor detecting ambient light.

like image 145
vikingosegundo Avatar answered Oct 13 '22 23:10

vikingosegundo