mirror of https://github.com/captn3m0/suntime.git
Update README
This commit is contained in:
parent
8531377d9c
commit
621f769441
|
@ -20,7 +20,14 @@ Crystal library for calculating sunrise and sunset times. Uses the algorithm fro
|
|||
require "suntime"
|
||||
|
||||
# Time is optional, local time is used otherwise
|
||||
Suntime.new(lat,long, time)
|
||||
# It returns sunrise/sunset for TODAY, so if you want the next sunset, check accordingly
|
||||
s = Suntime::Suntime.new(lat,long, time)
|
||||
# Bangalore
|
||||
s = Suntime::Suntime.new(12.955800, 77.620979)
|
||||
s.sunrise
|
||||
# 2020-05-22 05:52:48.0 +05:30 Local
|
||||
s.sunset
|
||||
# 2020-05-22 18:39:43.0 +05:30 Local
|
||||
```
|
||||
|
||||
## Development
|
||||
|
|
|
@ -8,6 +8,7 @@ describe Suntime do
|
|||
l = Time::Location.load("America/New_York")
|
||||
t = Suntime::Suntime.new(lat, lng, Time.local(1990, 6, 25, 0, 0, 0, location: l))
|
||||
|
||||
# TODO: These are stupid tests, figure out how to use epsilon for float tests in Crystal
|
||||
t.day_of_year.should eq(176)
|
||||
t.approx_time.should eq(176.45638888888888)
|
||||
t.approx_time(false).should eq(176.95638888888888)
|
||||
|
|
Loading…
Reference in New Issue