DonationCoder.com Software > Finished Programs
DONE - IDEA: commandline/console program to calculate sunrise/sunset times
LuckMan212:
There are some handy utils for un*x systems that can do the task of calculating sunrise/sunset/civil twilight/etc times given a latitude and longitude input. Unfortunately I was not able to locate any win32 console apps that can do this reliably. I found one written by an author who is no longer reachable and his contains a daylight-savings bug (DST calculation doesn't seem to work). Daylight savings is a very important and tricky factor.
The reason I would like to have such a program is to use it in batch files to schedule home automation tasks such as turning out outside lights, controlling thermostat settings etc, based on sunrise/sunset/twilight times which change each day.
As a starting point you might consider the following URLs for assistance with the algorithms:
http://www.codeproject.com/datetime/srss.asp
http://www.freevbcode.com/ShowCode.asp?ID=341
http://xoomer.virgilio.it/vtomezzo/sunriset/formulas/index.html
there are others but that is a start...
will anyone be so kind as to create this program?? ;) all it needs to do is output the time in 24hour hh:mm format, no fancy GUI is needed (at least for me!). It would be good if it can accept some commandline arguments such as specifying a date manually (default would be todays date) and also the ability to output only the time you need for example just the SUNRISE time.
example:
>suntime.exe 40.734N 73.986W -time sunrise
05:39
>suntime.exe 40.734N 73.986W -time sunset
17:33
>suntime.exe 40.734N 73.986W -time twilight
16:55
etc etc...
:Thmbsup:
jazper:
Give this a try:
SYNTAX: suntime.exe <latitude> <longitude> -time <sunrise|sunset|moonset|moonrise|twilight>
http://www.zaboo.net/kdunlap/suntime.zip
jazper
mouser:
jazper - care to give us some info on the programmer of the util - is it you?
jazper:
Sorry, I wrote the app.
And I updated it as well,.
Changed:
- Latitude needs suffix N or S for North and South
- Longitude needs suffix E or W for East and West
- Output time is based on local time
SYNTAX: suntime.exe <latitude[N|S]> <longitude[E|W]> -time <sunrise|sunset|moonset|moonrise|twilight>
http://www.zaboo.net/kdunlap/suntime.zip
jazper
mouser:
wow - wonderful! :Thmbsup:
ps.
if you're interested in setting up a little icon under your name where people can make a donation to support your coding (don't expect much if anything but still it's the principle and we want to encourage people to donate to coders), there's a link to some instructions here: https://www.donationcoder.com/forum/index.php?topic=1283.0
Navigation
[0] Message Index
[#] Next page
Go to full version