Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Module which calculates sunrise and sunset times
Ruby
Branch: master
Pull request Compare This branch is 22 commits ahead, 45 commits behind joeyates:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
sun-times.gemspec

README.md

SunTimes

Build Status

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

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

References

License

MIT License (see LICENSE.txt)

Something went wrong with that request. Please try again.