3 unstable releases

0.1.0 Nov 20, 2022
0.0.2 May 2, 2020
0.0.1 Nov 14, 2019

#329 in Date and time

Download history 33/week @ 2024-02-18 9/week @ 2024-02-25 1/week @ 2024-03-03 1/week @ 2024-03-10 50/week @ 2024-03-31

51 downloads per month
Used in circadian_time

MIT license

17KB
372 lines

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"));
}

lib.rs:

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

Dependencies

~1MB
~18K SLoC