Crate suncalc[][src]

Expand description

The sun crate is a library for calculating the position of the sun. It is a port of the JavaScript library suncalc.

Example

let unixtime = sun::Timestamp(1362441600000);
let lat = 48.0;
let lon = 9.0;
let pos = sun::get_position(unixtime,lat,lon);
let az  = pos.azimuth.to_degrees();
let alt = pos.altitude.to_degrees();
println!("The position of the sun is {}/{}", az, alt);

Structs

Holds the azimuth and altitude angles of the sun position.

UNIX timestamp in milliseconds

Functions

Calculates the sun position for a given date and latitude/longitude. The angles are calculated as radians.