Skip to content
A Rust library for calculating sun positions
Branch: master
Clone or download
Latest commit 6431e8b Feb 12, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore initial commit Jul 16, 2015
.travis.yml remove clippy dependency Nov 11, 2016
Cargo.toml add some more badges Feb 12, 2018
README.md add some more badges Feb 12, 2018
appveyor.yml add appveyor config Feb 12, 2018
dev-env.nix added nix expression Oct 2, 2015

README.md

sun

A rust port of the JS library suncalc.

Build Status Build status

Install

Add the following to your Cargo.toml

[dependencies]
sun = "0.2"

Usage

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);
}
You can’t perform that action at this time.