So after a month of testing, the compare code most definitely breaks after the clock switches past midnight. I hacked and played, but to no avail. I have reverted back to my original idea of comparing DateTime objects, that I documented in Benchmark routines earlier in the thread. Although the modules that 1nickt suggested were good ideas, they did not provide what I needed in the specific manner in which I needed them.

So right now, I'm doing trials with this code starting at line 114 and ending at line 191. I have left the private functions immediately beneath the main method in this commit for clarity here. I've also made immortal the link by ensuring that the file is referenced to the commit itself.

In all my testing so far, it works exactly how I need. I have two RPis running this code, both set with different times and time zones (and different "light on" times along with different "light on hours" times). We'll see what happens.


In reply to Re^4: Efficiency of indoor grow light timer by stevieb
in thread Efficiency of indoor grow light timer by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.