Crate sun [−] [src]
The sun
crate is a library for calculating the position of the sun.
It is a port of the JavaScript library
suncalc.
Example
extern crate sun; pub fn main() { let unixtime = 1362441600000; let lat = 48.0; let lon = 9.0; let pos = sun::pos(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
Position |
Functions
pos |
Calculates the sun position for a given date and latitude/longitude. The angles are calculated as radians. |