sunrise-next

Crates.iosunrise-next
lib.rssunrise-next
version
sourcesrc
created_at2023-06-17 11:10:16.926626
updated_at2024-12-07 16:32:42.91255
descriptionSunrise and sunset calculator
homepage
repositoryhttps://github.com/nathan-osman/rust-sunrise
max_upload_size
id892833
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Rémi Dupré (remi-dupre)

documentation

README

sunrise

This is a fork of nathan-osman's crate to test new features.

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

You can enable the no-std feature if you need it to work in such a context, it will rely on libm instead.

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-next = "1.3"

You can use the sunrise_sunset function to perform the calculation:

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

If you need more refined control, you can use the SolarDay struct:

use sunrise_next::{sunrise_sunset, SolarDay, SolarEvent, DawnType};

let dawn = SolarDay::new(43.6532, -79.3832, 2016, 1, 1)
    .with_altitude(54.)
    .event_time(SolarEvent::Dawn(DawnType::Civil));
Commit count: 33

cargo fmt