Skip to content
forked from flosse/rust-sun

A Rust library for calculating sun positions

Notifications You must be signed in to change notification settings

RustWorks/rust-sun

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

About

A Rust library for calculating sun positions

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 93.3%
  • Nix 6.7%