Menu

Another DST boundary issue?

noiambujo
2020-11-02
2020-11-02
  • noiambujo

    noiambujo - 2020-11-02

    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 and running the following (prints NIGHT)
    "./sunwait poll offset 0 <coords>"
    If I run it with a -5 min offset it says DAY. But it should not do that until 06:25, not 05:25. if i set the date to 11/02/2020 it operates properly. So the isDay function logic seems to have issues only on the day entering or leaving Daylight Savings Time.</coords>

    I'm trying to figure out how the code added in support of Pho Quartz's DST boundary condition issue might be applicable (missing?) to the isDay function, but I'm in over my head. I'll give it a try for a bit to see if I can figure it out. If you have any suggestions I'd appreciate it. Thanks!

     
  • noiambujo

    noiambujo - 2020-11-02

    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 now for my test case

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.