Sha256: 1580a562657ee103fdceab02c31e6a655ffeab6d4e63fcb9757b9521005141a2

Contents?: true

Size: 692 Bytes

Versions: 5

Compression:

Stored size: 692 Bytes

Contents

#!/usr/bin/env ruby

lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

lat = 39.742476
lon = -105.1786

require 'calc_sun'
cs = CalcSun.new

# require 'date' is included in CalcSun class
ajd = DateTime.new(2003, 10, 17, 12, 30, 30).ajd.to_f
puts cs.ajd2dt(ajd)

# set the date/time with #set_datetime as date and time string.
# this just creates a DateTime object and you could create your own.
day = cs.set_datetime('2003-10-17 12:30:30')
puts day

puts "Sun rise: #{cs.rise(day.ajd, lat, lon).httpdate}"
puts "Sun noon: #{cs.noon(day.ajd, lat, lon).httpdate}"
puts "Sun set: #{cs.set(day.ajd, lat, lon).httpdate}"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
calc_sun-1.2.10 example/sunriset.rb
calc_sun-1.2.9 example/sunriset.rb
calc_sun-1.2.8 example/sunriset.rb
calc_sun-1.2.7 example/sunriset.rb
calc_sun-1.2.6 example/sunriset.rb