nathan-osman / rust-sunrise Goto Github PK
View Code? Open in Web Editor NEWCrate for calculating sunrise / sunset times
License: MIT License
Crate for calculating sunrise / sunset times
License: MIT License
There's an error in coordinates that are used in the usage example in the readme file.
The readme gives the following example
// Calculate times for January 1, 2016 in Toronto
let (sunrise, sunset) = sunrise::sunrise_sunset(
43.6532,
79.3832,
2016,
1,
1,
);
However, the valid coordinates for Toronto in Lat Lng format are 43.6532, -79.3832
. Therefore the example above should be written this way:
// Calculate times for January 1, 2016 in Toronto
let (sunrise, sunset) = sunrise::sunrise_sunset(
43.6532,
-79.3832,
2016,
1,
1,
);
It took me a bit of time at first to figure out why computations were incorrect.
I'd love to use this crate for a crate that provide an engine for OSM's opening hours, but it can be based on dawn and dusk. I'd be willing to make a PR that implement this change but I need some help understanding where to make a change. (This may also motivate to change a bit the API if there is more values to output).
Wikipedia defines "civil dawn" as follow:
Civil dawn begins when there is enough light for most objects to be distinguishable, so that some outdoor activities can commence. Formally, it occurs when the Sun is 6 degrees below the horizon in the morning.[4]
So this is seems it is just about adding / removing a 6° angle somewhere, should it be directly added / removed the sun declination,
Thanks for implementing this function.
However from reading the documentation I see that the function returns a tuple of i64
. I do not yet understand how this i64
is representing a sunrise/sunset time. What is the encoding.
More specifically, how to convert this into something like a chrono::naive::NaiveTime
I've found your crate of sunrise/sunset equation implementation exactly what I need in my embedded project. :)
Would you consider releasing a newer version of your package after time dependency removal?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.