Skip to content

Instantly share code, notes, and snippets.

@stanislaw
Forked from njh/sunrise.rb
Created March 25, 2012 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stanislaw/2199876 to your computer and use it in GitHub Desktop.
Save stanislaw/2199876 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