Skip to content

Crate for calculating sunrise / sunset times

License

Notifications You must be signed in to change notification settings

PhysicalGraph/rust-sunrise

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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,
);

About

Crate for calculating sunrise / sunset times

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%