<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font size="-1"><font face="Arial">ok so logically in code u dont
        see it as wrap around so 9pm to 5am would be 0am to 5am and 9pm
        to 0am and if days 1-2 then on both days because the code
        evaluate on a per day basis rather than across multiple days and
        applies the same to the day1 and day2.<br>
        <br>
        do u still agree the to time needs to be one second shorter than
        the from time for the code to evaluate it properly or else
        5pm-5pm would result in 0 and the way to specify full 24 hrs
        needs to be 5pm-4:59pm<br>
        <br>
        <br>
      </font></font>
    <div class="moz-signature">
      <style>
body {
  font-family: Verdana, sans-serif;
  font-size: 0.8em;
  color:#484848;
}
h1, h2, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin:0in; margin-bottom:.0001pt; }
p.footr { font-family: "Trebuchet MS", Verdana, sans-serif; margin:0in; margin-bottom:.0001pt; }
h1 { font-size: 1.2em; }
h2, h3 { font-size: 1.1em; }
a, a:link, a:visited { color: #2A5685;}
a:hover, a:active { color: #c61a1a; }
a.wiki-anchor { display: none; }
hr {
  width: 100%;
  height: 1px;
  background: #ccc;
  border: 0;
}
</style>Regards,<br>
      Bipin<br>
      <br>
      <br>
      <hr>
    </div>
    <div class="moz-cite-prefix">-------- Original Message --------<br>
      Subject: Re: [Freeswitch-users] week day and time condition
      possible bug<br>
      From: Ken Rice <a class="moz-txt-link-rfc2396E" href="mailto:krice@freeswitch.org">&lt;krice@freeswitch.org&gt;</a><br>
      To: FreeSWITCH Users Help
      <a class="moz-txt-link-rfc2396E" href="mailto:freeswitch-users@lists.freeswitch.org">&lt;freeswitch-users@lists.freeswitch.org&gt;</a><br>
      Date: 9/4/2016, 8:08:31 PM<br>
    </div>
    <blockquote
      cite="mid:87ADB87D-7BD3-4A46-84F8-4EDB14661D7D@freeswitch.org"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      <div>Wrong there is no wrap around time.. There is only ranges of
        time on a day...</div>
      <div id="AppleMailSignature"><br>
      </div>
      <div id="AppleMailSignature">Look back at the code i pasted again.</div>
      <div id="AppleMailSignature"><br>
      </div>
      <div id="AppleMailSignature">If start time &gt; end time then we
        check to see if current time &lt; end time OR &gt; start time
        again i. Seconds and for symplicity we'll use just 60 of them</div>
      <div id="AppleMailSignature"><br>
      </div>
      <div id="AppleMailSignature">If the rand is 45 through 15 then we
        do the false part of the exp?true:false which is (<span
          style="background-color: rgba(255, 255, 255, 0); font-size:
          0.8em;">val &gt;= range_start || val &lt;= range_end)</span></div>
      <div id="AppleMailSignature"><br>
      </div>
      <div id="AppleMailSignature">So now start is 45 and end is 15 so
        we look for the time to &gt;= 45 or &lt;= 15 again on day 1 or
        day 2 assuming wday="1-2"</div>
      <div id="AppleMailSignature"><br>
      </div>
      <div id="AppleMailSignature">So there is no "wrap around time"
        there is no wday=1-2" and timeofday="9p-5a" and an expectation
        of that only working from 9p on day 1 to 9p on day 2 thats day 1
        from 00:00 to 05:00 and from 21:00 til 23:59:59 then the same
        thing on day 2.</div>
      <div id="AppleMailSignature"><br>
      </div>
      <div id="AppleMailSignature"><br>
      </div>
      <div id="AppleMailSignature"><br>
        Sent from my iPhone</div>
      <div><br>
        On Sep 4, 2016, at 10:33 AM, Bipin Patel &lt;<a
          moz-do-not-send="true" href="mailto:bipin@xbipin.com">bipin@xbipin.com</a>&gt;
        wrote:<br>
        <br>
      </div>
      <blockquote type="cite">
        <div>
          <meta content="text/html; charset=windows-1252"
            http-equiv="Content-Type">
          <font size="-1"><font face="Arial">thanks for the detailed
              explanation :)<br>
              <br>
              so what i make of this is if u use a wrap around time or u
              want full 24 hours either in same day or across days then
              u need to set one second lower so "5:00-5:00" should
              actually be "5:00:00-4:59:59" which would be 5am from
              today to 4:59:59am tomorrow and same goes for
              "00:00:00-00:00:00" which should be "00:00:00-23:59:59"<br>
              <br>
              now same if u combine with wday then again u need to
              specify a second lower in the max time for it to work
              properly if the start and end time is set same or it will
              read it as 0<br>
              <br>
              <br>
            </font></font>
          <div class="moz-signature">
            <style>
body {
  font-family: Verdana, sans-serif;
  font-size: 0.8em;
  color:#484848;
}
h1, h2, h3 { font-family: "Trebuchet MS", Verdana, sans-serif; margin:0in; margin-bottom:.0001pt; }
p.footr { font-family: "Trebuchet MS", Verdana, sans-serif; margin:0in; margin-bottom:.0001pt; }
h1 { font-size: 1.2em; }
h2, h3 { font-size: 1.1em; }
a, a:link, a:visited { color: #2A5685;}
a:hover, a:active { color: #c61a1a; }
a.wiki-anchor { display: none; }
hr {
  width: 100%;
  height: 1px;
  background: #ccc;
  border: 0;
}
</style>Regards,<br>
            Bipin<br>
            <br>
            <br>
            <hr> </div>
          <div class="moz-cite-prefix">-------- Original Message
            --------<br>
            Subject: Re: [Freeswitch-users] week day and time condition
            possible bug<br>
            From: Ken Rice <a moz-do-not-send="true"
              class="moz-txt-link-rfc2396E"
              href="mailto:krice@freeswitch.org">&lt;krice@freeswitch.org&gt;</a><br>
            To: FreeSWITCH Users Help <a moz-do-not-send="true"
              class="moz-txt-link-rfc2396E"
              href="mailto:freeswitch-users@lists.freeswitch.org">&lt;freeswitch-users@lists.freeswitch.org&gt;</a><br>
            Date: 9/4/2016, 7:14:25 PM<br>
          </div>
          <blockquote
cite="mid:CAPcNkdcSgRdgR+mMK=po+JjWf5u89jvaJjVWqY=wf=6eNs51dQ@mail.gmail.com"
            type="cite">
            <div dir="ltr">
              <div>
                <div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>Ok lets try to make sense of this.<br>
                            <br>
                          </div>
                          The time-of-day matching in your initial email
                          <br>
                          &gt;&gt;<font size="-1"><font face="Arial">
                                    &lt;condition wday="1-2"
                              time-of-day="00:00:00-00:00:<wbr>00"
                              break="never"&gt;<br>
                              <br>
                            </font></font></div>
                        <font size="-1"><font face="Arial">happens in 2
                            stages... stage 1) does wday fall in the
                            range of 1-2<br>
                          </font></font></div>
                      <font size="-1"><font face="Arial">wday="1-2"<br>
                        </font></font></div>
                    <font size="-1"><font face="Arial">wdaymin = 1<br>
                      </font></font></div>
                  <font size="-1"><font face="Arial">wdayamx = 2<br>
                    </font></font></div>
                <font size="-1"><font face="Arial">so does if (today
                    &gt;= wday-min || today &lt;= wday-max).... if you
                    set this for 0-0 or 1-1 then only day 0 or only day
                    1 would match. Now the above example is simplified
                    psuedo code just for the sake of explanation...<br>
                    <br>
                  </font></font></div>
              <div><font size="-1"><font face="Arial">The time-of-day
                    matching works similarly... after the value for the
                    time of day field is parsed the following if
                    statement (actually taken from the code) happens<br>
                    <br>
                    if (range_start &lt;= range_end ? (val &gt;=
                    range_start &amp;&amp; val &lt;= range_end) : (val
                    &gt;= range_start || val &lt;= range_end)) { ... }<br>
                    <br>
                  </font></font></div>
              <div><font size="-1"><font face="Arial">so this allos for
                    the range_end to be a lower value... however the
                    same thing happens does the current time val fall in
                    the range of times... so if you set the start and
                    the end time to 00:00:00 the only time it will match
                    is 00:00:00. lets reduce this for the sake of
                    simplicity from the long date to just seconds of the
                    day... 00:00:00 == second 0 for the day... so <br>
                    <br>
                    <br>
                  </font></font></div>
              <div><font size="-1"><font face="Arial">range start is
                    &lt;= range_end (in fact its 0) so ... we'll do the
                    true half of the expression?true:false statement
                    there...<br>
                  </font></font></div>
              <div><font size="-1"><font face="Arial">if (val &gt;=
                    range_start &amp;&amp; val &lt;= range_end)  where
                    val is the current number of seconds into today... <br>
                    <br>
                  </font></font></div>
              <div><font size="-1"><font face="Arial">so you have told
                    it that the only range that can match is 0 thru 0
                    inclusive... how can any other time match... <br>
                    <br>
                  </font></font></div>
              <div><font size="-1"><font face="Arial">so in your example
                    there are only 2 times that will match 00:00:00 on
                    day 1 and 00:00:00 on day 2... <br>
                    <br>
                  </font></font></div>
              <div><font size="-1"><font face="Arial">the proper way to
                    include an entire day is 00:00:00-23:59:59 which
                    covers all possible seconds in a range<br>
                  </font></font></div>
              <div>
                <div>
                  <div>
                    <div>
                      <div><font size="-1"><font face="Arial"><br>
                            <br>
                          </font></font></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="gmail_extra"><br>
            </div>
          </blockquote>
          <br>
        </div>
      </blockquote>
      <blockquote type="cite">
        <div><span>_________________________________________________________________________</span><br>
          <span>Professional FreeSWITCH Consulting Services: </span><br>
          <span><a moz-do-not-send="true"
              href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></span><br>
          <span><a moz-do-not-send="true"
              href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></span><br>
          <span></span><br>
          <span>Official FreeSWITCH Sites</span><br>
          <span><a moz-do-not-send="true"
              href="http://www.freeswitch.org">http://www.freeswitch.org</a></span><br>
          <span><a moz-do-not-send="true"
              href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a></span><br>
          <span><a moz-do-not-send="true" href="http://www.cluecon.com">http://www.cluecon.com</a></span><br>
          <span></span><br>
          <span>FreeSWITCH-users mailing list</span><br>
          <span><a moz-do-not-send="true"
              href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a></span><br>
          <span><a moz-do-not-send="true"
              href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></span><br>
          <span>UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://">http://</a><a moz-do-not-send="true"
              href="http://lists.freeswitch.org/mailman/options/freeswitch-users">lists.freeswitch.org/mailman/options/freeswitch-users</a></span><br>
          <span><a moz-do-not-send="true"
              href="http://www.freeswitch.org">http://www.freeswitch.org</a></span></div>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_________________________________________________________________________
Professional FreeSWITCH Consulting Services: 
<a class="moz-txt-link-abbreviated" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>

Official FreeSWITCH Sites
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://confluence.freeswitch.org">http://confluence.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://www.cluecon.com">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a></pre>
    </blockquote>
    <br>
  </body>
</html>