New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generalize sundial API #1

Merged
merged 5 commits into from May 3, 2017

Conversation

Projects
None yet
2 participants
@HankB
Copy link
Contributor

HankB commented May 3, 2017

Hi Zack,
Thanks for providing these calculations.
I'm not certain if you accept pull requests. If not, just ignore (delete?) If yes, read on.

Changes:

  • separate main() from calculations to facilitate using calculations in another program.
  • generalize public API to include time zone offset and time for which next sunrise/sunset is calculated
  • update README to reflect code changes.
  • add 'beer clause' to license.

best,
hank

(I will offer to buy you a beer should you ever be near Chicago or I near your location.)

@schollz

This comment has been minimized.

Copy link
Owner

schollz commented May 3, 2017

@HankB Ha, thanks! Submitting this PR is gratitude enough :)

I never thought anyone would use this...I wrote this for Arduino to control the gate on my chicken coop without having to phone home to figure out when sunset/sunrise was. Turns out Arduino doesn't have enough precision in its double to allow this calculation (I think it was off by hours). Glad you found it useful!

@schollz schollz merged commit f158e70 into schollz:master May 3, 2017

@HankB

This comment has been minimized.

Copy link
Contributor Author

HankB commented May 3, 2017

One of the reasons for pulling the 'time from' out of the calculation was so I could easily test results. Based on your comments I probably should do that. I'm surprised the calculations didn't work on the Arduino but I don't think I've ever tried any floating point on that architecture.

FWIW my use case is to turn outdoor lights on and off. I should probably spring for a light sensor but I like S/W solutions. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment