circadia

Crates.iocircadia
lib.rscircadia
version0.1.0
created_at2019-11-14 04:21:32.558195+00
updated_at2022-11-20 03:10:47.494488+00
descriptionCompute sunrise/sunset times
homepagehttps://github.com/hoggetaylor/circadia
repositoryhttps://github.com/hoggetaylor/circadia
max_upload_size
id181136
size26,934
Taylor Hogge (hoggetaylor)

documentation

https://docs.rs/circadia

README

Circadia

This crate provides a simple interface to compute information about the sunrise and sunset times on arbitrary dates at any position on the globe.

Installation

$ cargo add circadia --version 0.0.1

Usage

use circadia::{ GlobalPosition, SunEvent, time_of_event };
use chrono::Utc;

fn main() {
    // Nauticalia Greenwhich
    let pos = GlobalPosition::at(51.4810066, 0.0081805);
    let today = Utc::now().date();
    let sunrise_time = time_of_event(today, &pos, SunEvent::SUNRISE).unwrap();
    println!("Time of sunrise today: {}", sunrise_time.format("%r"));
}
Commit count: 10

cargo fmt