Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Forked from njh/sunrise.rb
Created September 16, 2023 19:50
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 Epictetus/4bebea23aaa8f639e94b7eec1356b43e to your computer and use it in GitHub Desktop.
Save Epictetus/4bebea23aaa8f639e94b7eec1356b43e 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