1 stable release

Uses old Rust 2015

1.0.0 Dec 15, 2018

#80 in Date and time

Download history 1061/week @ 2021-02-24 897/week @ 2021-03-03 820/week @ 2021-03-10 793/week @ 2021-03-17 739/week @ 2021-03-24 1220/week @ 2021-03-31 1232/week @ 2021-04-07 781/week @ 2021-04-14 1121/week @ 2021-04-21 1005/week @ 2021-04-28 707/week @ 2021-05-05 775/week @ 2021-05-12 1063/week @ 2021-05-19 623/week @ 2021-05-26 894/week @ 2021-06-02 1479/week @ 2021-06-09

4,044 downloads per month
Used in 2 crates

MIT license

22KB
206 lines

sunrise

Build Status MIT License

This crate provides a function for calculating sunrise and sunset times using this method.

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:

[dependencies]
sunrise = "1.0.0"

Next, add a declaration for the crate:

extern crate sunrise;

You can use the sunrise_sunset function to perform the calculation:

// Calculate times for January 1, 2016 in Toronto
let (sunrise, sunset) = sunrise::sunrise_sunset(
    43.6532,
    79.3832,
    2016,
    1,
    1,
);

Dependencies

~1MB
~13K SLoC