Skip to content

Instantly share code, notes, and snippets.

@njh
Created September 11, 2011 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save njh/1210228 to your computer and use it in GitHub Desktop.
Save njh/1210228 to your computer and use it in GitHub Desktop.
Ruby Code to calculate sunrise and sunset times where I live
#!/usr/bin/env ruby
require 'rubygems'
require 'solareventcalculator'
solar = SolarEventCalculator.new(Date.today, BigDecimal.new('51.563'), BigDecimal.new('-0.499'))
puts "Sunrise: #{solar.compute_utc_civil_sunrise.getlocal}"
puts "Sunset: #{solar.compute_utc_civil_sunset.getlocal}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment