SunTimes
This is a Fork of joeyates/ruby-sun-times and is avalible as sun-times gem so there is no explicit require
necessary in Bundler projects.
Calculates sunrise and sunset times.
An implementation of the algorithm described at http://williams.best.vwh.net/sunrise_sunset_algorithm.htm
Installation
Add this line to your application's Gemfile:
gem 'sun-times'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sun-times
Usage
SunTimes.rise(Date.new(2010, 3, 8), 51.506318, 7.460659) # => 2010-03-08 06:01:02 UTC
SunTimes.calculate(:set, Date.new(2010, 3, 8), 51.506318, 7.460659) # => 2010-03-08 06:01:02 UTC
SunTimes.set(Date.new(2010, 3, 8), 51.506318, 7.460659) # => 2010-03-08 17:22:07 UTC
SunTimes.calculate(:set, Date.new(2010, 3, 8), 51.506318, 7.460659) # => 2010-03-08 17:22:07 UTC
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
References
- http://www.astro.uu.nl/~strous/AA/en/reken/zonpositie.html - Calculations
- http://williams.best.vwh.net/sunrise_sunset_algorithm.htm - Algorithm
- http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/264573 - Ken Bloom's implementation
License
MIT License (see LICENSE.txt)