Closed markus-k closed 1 year ago
Thank you!
It would be nice to add (optional) support for the
chrono
crate, so you don't have to manually convert the timestamps to something usable after every call. That would be a separate PR though and maybe even a breaking change dependening on how it's done.
I'd avoid chrono
(not maintained & security issues) but we could use time
BTW: what do you think about using typed units with e.g. dimensioned
?
I like chrono
s DateTime and timezone handling, and haven't used time
itself before. But that might be an upgrade already, I might look into if I can find the time.
I haven't heard about the dimensioned
crate before. I like the idea, but I'm not sure yet if I like their implementation from what I've seen. It might be a bit overkill here as well, since the only unit we have is degrees.
This PR adds a function to calculate the time of sun phases like sunset, sunrise at a given date. Like
sun::pos
, it is mostly ported from thesuncalc
npm-package, with exception that it only calculates the time for one phase instead of a whole bunch (seemed more efficient/suitable to me). The function returns a timestamp (in ms).It would be nice to add (optional) support for the
chrono
crate, so you don't have to manually convert the timestamps to something usable after every call. That would be a separate PR though and maybe even a breaking change dependening on how it's done.