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!