That's a really cool idea.  Looks like you're doing it all with math
and no external (web) lookups?  How long does just the math way stay
accurate?  Don't you need to account for wobble and things that may
subtly change over time (assuming they do, I thought something did)?

Yep, it's all math-based - the calculations used "[...] are theoretically accurate to within a minute for locations between +/- 72° latitude, and within 10 minutes outside of those latitudes.".  That's via https://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html, which is used by "sunrise.c" (original available here).  The explanation claims that the calculation is valid until the year 3000!  I'm not clear if it handles wobble and other things - the calculations are mostly a black box for me.

Anecdotally it seems to be working fine on my box :)

You should crisp it up as much as possible and submit it to the cron
upstream!  Has to be self-contained, clean and accurate though
(probably).

I might do this at some point, it could use more cleanup - I have just noticed that debian's cron package is a major version behind the upstream as well

Thanks for the feedback!


On Sun, Jul 5, 2020 at 3:59 AM Trevor Cordes <trevor@tecnopolis.ca> wrote:
On 2020-07-04 Troy Denton wrote:
> A fun side project of mine - I've patched the Debian 'cron' source to
> provide @sunrise and @sunset, similar to @reboot

That's a really cool idea.  Looks like you're doing it all with math
and no external (web) lookups?  How long does just the math way stay
accurate?  Don't you need to account for wobble and things that may
subtly change over time (assuming they do, I thought something did)?

You should crisp it up as much as possible and submit it to the cron
upstream!  Has to be self-contained, clean and accurate though
(probably).

Good clean code layout.  Nice.  Extra hero cookie for C.
_______________________________________________
Roundtable mailing list
Roundtable@muug.ca
https://muug.ca/mailman/listinfo/roundtable