sunrise
This crate provides a function for calculating sunrise and sunset times using this method.
To work in a no-std environment disable the default features and enable the libm feature.
Usage
In order to perform the calculation, you'll need to provide the following:
- the date for which you wish to calculate the times
- the latitude and longitude of the location
Begin by adding this crate to Cargo.toml:
[]
= "1.2"
You can use the SolarDay struct to perform computation of an event at a
particular place and time:
use NaiveDate;
use ;
// January 1, 2016 in Toronto
let date = from_ymd_opt.unwrap;
let coord = new.unwrap;
let dawn = new
.with_altitude
.event_time;