lib/tlapse/solar_event.rb in tlapse-0.7.0 vs lib/tlapse/solar_event.rb in tlapse-0.8.0
- old
+ new
@@ -1,26 +1,26 @@
require "solareventcalculator"
+require "tlapse/config"
module Tlapse
module SolarEvent
- LAT = 35.779590
- LON = -78.638179
- TZ = "America/New_York"
-
def self.sunrise
- s = solar_event.compute_official_sunrise(TZ)
- n = Time.new
+ tz = Tlapse::Config.get "tz"
+ s = solar_event.compute_official_sunrise(tz)
+ n = Time.new
Time.new(n.year, n.month, n.day, s.hour, s.minute)
end
def self.sunset
- s = solar_event.compute_official_sunset(TZ)
- n = Time.new
+ tz = Tlapse::Config.get "tz"
+ s = solar_event.compute_official_sunset(tz)
+ n = Time.new
Time.new(n.year, n.month, n.day, s.hour, s.minute)
end
def self.solar_event
date = Date.new
- SolarEventCalculator.new date, LAT, LON
+ lat, lon = Tlapse::Config.get "lat", "lon"
+ SolarEventCalculator.new date, lat, lon
end
end
end