UPDATE - I added the following code to the getMidnightUTC() function, like the other DST patch, at line 544 of my local copy struct tm localTm; myLocalTime (&pRun->nowTimet, &localTm); int isdst = localTm.tm_isdst; tmpTm.tm_isdst = isdst; With the code "borrowed" from the previous isdst fix, it apears to now properly print DAY and NIGHT transitions at the proper times on the days before, on and after the DST timezone change. Hopefully my assumptions are correct - sunwait appears to work properly...
Hello - first, thanks for creating sunwait! I use it for detecting if the current time is DAY or NIGHT, and open or close my chicken coop door accordingly (+/- an offset). I am using it in an area that uses DST. Upon leaving DST this morning (from EDT to EST) the DAY/NIGHT (poll) feature broke for today (11/01/2020). Sunrise was 06:25 (as verified by sunwait list offset 0), but the poll feature returned DAY at 05:25 instead of at 06:25. I've reproduced it by setting my system's date to 05:20 11/01/2020...
I wrote sunwait in 2000, and abandoned it in 2004. Someone asked me about it recently and I promised I'd move it to GitHub to make the code more collaboration-friendly. So I stood up a repo on GitHub at https://github.com/risacher/sunwait I also pulled in the bugfix suggested by Phos Quartz in December 2018 and I implemented the 'solarnoon' feature that someone asked for in 2017. (That's in a branch for now, since I want to test it a bit more: https://github.com/risacher/sunwait/tree/solarnoon )
Hello. I found a bug in the code, and I have a 4-line fix. Surface Symptom Two days out of every year in my time zone, on the days when DST switches, sunwait's output is wrong by one hour. The following day it's back to normal. Closer Study The code calculates 2 time stamps, "Now" and "Target;" the latter may be midnight UTC the same day as "Now," or that of a user-specified day. However it fails to account for the possibility that the interval between "Now" and "Target" might span a change in DST,...
Hello. I found a bug in the code, and I have a 4-line fix. Surface Symptom Two days out of every year in my time zone, on the days when DST switches, sunwait's output is wrong by one hour. The following day it's back to normal. Closer Study The code calculates 2 time stamps, "Now" and "Target;" the latter may be midnight UTC the same day as "Now," or that of a user-specified day. However it fails to account for the possibility that the interval between "Now" and "Target" might span a change in DST,...
I know why this doesn't work, but I can't follow the intended logic. I can't find any details on how strftime() obtains the format conversion for %z. Even the author of Sunwait calls this "secret magic" (line 463). The man page says it uses the environment variables TC and LC_TIME, but getenv() returns NULL for these names both before and after the call to mktime(). The reason it fails here is because a struct tm is being used to represent "UTC." This is not entirely possible; the docs show this...
Since I was looking at this problem just as DST was changing, I've just had the rare opportunity to catch another bug associated with this boundary condition: Debug: All output to use local timezone (nogmt). Debug: Now utcTm: Sun Nov 4 01:56:14 2018 GMT Debug: Now localTm: Sat Nov 3 21:56:14 2018 EDT Debug: Now UTC bias (add to GMT to get EDT) hours: -5.000000 I have checked an double-checked both my local and UTC time. I know my UTC offset right now is -4. Count on your fingers and see the given...
Since I was looking at this problem just as DST was changing, I've just had the rare opportunity to catch another bug associated with this boundary condition: Debug: All output to use local timezone (nogmt). Debug: Now utcTm: Sun Nov 4 01:56:14 2018 GMT Debug: Now localTm: Sat Nov 3 21:56:14 2018 EDT Debug: Now UTC bias (add to GMT to get EDT) hours: -5.000000 I have checked an double-checked both my local and UTC time. I know my UTC offset right now is -4. Count on your fingers and see the given...
(All of the above is in reference to version 0.8, btw, not version 0.4 as represented in the SourceForge Git repo accessible from the "Code" tab above.)
Hello. I found a bug in the code, and I have a single-line fix. Surface Symptom Two days out of every year in my time zone, on the days when DST switches, sunwait's output is wrong by one hour. The following day it's back to normal. Closer Study The code calculates 2 time stamps, "Now" and "Target;" the latter may be midnight UTC the same day as "Now," or that of a user-specified day. However it fails to account for the possibility that the interval between "Now" and "Target" might span a change...
Hello. I found a bug in the code, and I have a single-line fix. Surface Symptom Two days out of every year in my time zone, on the days when DST switches, sunwait's output is wrong by one hour. The following day it's back to normal. Closer Study The code calculates 2 time stamps, "Now" and "Target;" the latter may be midnight UTC the same day as "Now," or that of a user-specified day. However it fails to account for the possibility that the interval between "Now" and "Target" might span a change...
At first I thought it might be because you omit the 'rise/set' option, but actually mine seems not to require that. Maybe it has to do with your invocation method. (I don't know anything about Windows.)
Any ideas why it's not waiting? Please see attached screenshot.
sunriset.cpp 95c95 < if (abs(cost) < 1.0) --- > if (fabs(cost) < 1.0) makefile 12a13 > OBJECTS_ONLY=sunwait.o sunriset.o print.o 18c19 < $(C) $(OBJECTS) -o $@ $(LDFLAGS) --- > $(C) $(OBJECTS_ONLY) -o $@ $(LDFLAGS) sunwait.cpp 37c37 < #if defined __linux__ --- > #if defined __linux__ || defined __APPLE__ 398c398 < #if defined __linux__ --- > #if defined __linux__ || defined __APPLE__ 418c418 < #if defined __linux__ --- > #if defined __linux__ || defined __APPLE__ 480c480 < #if defined __linux__ ---...
sunriset.cpp 95c95 < if (abs(cost) < 1.0) --- > if (fabs(cost) < 1.0) makefile 12a13 > OBJECTS_ONLY=sunwait.o sunriset.o print.o 18c19 < $(C) $(OBJECTS) -o $@ $(LDFLAGS) --- > $(C) $(OBJECTS_ONLY) -o $@ $(LDFLAGS) sunwait.cpp 37c37 < #if defined __linux__ --- > #if defined __linux__ || __APPLE__ 398c398 < #if defined __linux__ --- > #if defined __linux__ || __APPLE__ 418c418 < #if defined __linux__ --- > #if defined __linux__ || __APPLE__ 480c480 < #if defined __linux__ --- > #if defined __linux__...
Turns out MacPorts knew it was broken but didn't know why. I linked them to this discussion.
Hey guys, thank you for this project! It's great! I own a desktop with macOS 10.12, and have installed Sunwait through MacPorts. This was evidently outside your direct intention as the developers, because some of the code is wrapped in #ifdefs that neglect OSX, and it therefore doesn't execute. Because with most inputs this causes no crash, the MacPorts maintainers seem not to have noticed. (I will link them to this discussion too.) Instead all the outputs are nonsense. I got it to compile with only...
Hey guys, thank you for this project! It's great! I own a desktop with macOS 10.12, and have installed Sunwait through MacPorts. This was evidently outside your direct intention as the developers, because some of the code is wrapped in #ifdefs that neglect OSX, and it therefore doesn't execute. Because with most inputs this causes no crash, the MacPorts maintainers seem not to have noticed. (I will link them to this discussion too.) Instead all the outputs are nonsense. I got it to compile with only...
Been using Sunwait to control the collection and uploading of images from a weather camera with great success! A fantastic little program! Is it possible to have to software 'wait' until the sun is directly overhead locally? I tried waiting for a custom angle, and chose 90º, however the program simply ran immediately. According to the timeanddate.com the sun's angle at noon is only about 62º. This changes daily of course. I know Sunwait can report the time of solar noon if you run a 'report', but...
Thanks for this program/source with added features. Successfully compiled for Asus...
Looking at the source code I figured that the year, month, and day of the month parameters...
The help summary shows that a target date can be specified but I can't get it to...
I am actually in the states (Austin Texas) so not only do we have DST, it is all...
I am actually in the states (Austin Texas) so not only do we have DST, it is all...
I was thinking about S Morgan's trouble in Manilla. Sunwait has had bugs with time...
International time makes my head spin. Ran: sunwait report 30.19N -97.80W gmt. The...
The first picture of the sunwait project on sourceforge.net shows the script placed...
Compiled 0.8 on Ubuntu Run the following: zm:~$ date Thu Nov 12 16:07:30 CST 2015...
This applicationn is exactly what I have been looking for. However, I cannot find...
Broken negative angle/hour reduction: revolution()
I've just released version 0.8. I've been asked to release the Linux code as a tar-ball....
It's nearly ready. I've resolved the dateline and high latitude problems. I've also...
I'm working on the next release. The code has problems near the dateline (noon at...
Well, it's done. Hopefully both the Linux and Windows functionality of the same code...
The road to hell is paved with good intentions. Visual Studio doesn't support the...
I'm finishing up version 0.7. Hopefully the timezone and daylight savings troubles...
Still working on a fix. I now have a much better understanding of the C/timezone...
There's a problem with Sunwait's understanding of time. I had assumed that the C...
I've not got XP anymore. I'll have to have a think about it. This might help: ht...
Hi! Thx for sunwait, but I have a problem. It works under Win7 x64, but under XP...
I've just added the Windows program "sunwait.exe" for your convenience. Unix users...
I tried using a fixed time duration to switch on lights just before sunset; but,...
I've just released version 0.6. It should handle local time now. The sleep problem...
I've just released version 0.6. It should handle local time now. The sleep problem...
Thanks Robert. I didn't see your post until now. My port to Linux was very flakey,...
If using this code for a linux build by changing the comments then the sleep is in...