0.03
No commit activity in last 3 years
No release in over 3 years
Module which calculates sunrise and sunset times
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0
>= 0
 Project Readme

ruby-sun-times Build Status

Calculates sunrise and sunset times

The algorithm comes from the Almanac for computers.

Usage

Requiring

In a Gemfile/Gemspec:

gem 'ruby-sun-times', require: 'sun_times'

Directly:

require 'sun_times'

Methods

The two methods rise and set each return a Time.

day = Date.new(2010, 3, 8)
latitude = 43.779
longitude = 11.432
sun_times = SunTimes.new
sun_times.rise(day, latitude, longitude) # => 2010-03-08 05:39:53 UTC
sun_times.set(day, latitude, longitude) # => 2010-03-08 17:11:16 UTC

References