[asterisk-users] Time of Day Routing

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Aug 14 08:29:53 CDT 2009


On Friday 14 August 2009 08:15:55 Tony Mountifield wrote:
> In article <4A855630.5080801 at arcdiv.com>, SIP <sip at arcdiv.com> wrote:
> > Tony Mountifield wrote:
> > > In article <05D03313-994B-4892-B045-F61332DDB273 at geekinter.net>,
> > >
> > > Steve Howes <steve at geekinter.net> wrote:
> > >> On 14 Aug 2009, at 09:17, Neeraj Chand wrote:
> > >>> Asterisk version 1.4
> > >>> From: Neeraj Chand
> > >>> Sent: Friday, 14 August 2009 8:17 PM
> > >>> To: 'asterisk-users at lists.digium.com'
> > >>> Subject: [asterisk-users] Time of Day Routing
> > >>>
> > >>> Hi David,
> > >>>
> > >>> With this:
> > >>>    ifTime(00:00-12:00|*|*|*)
> > >>>
> > >>> Whatever time you specify at the end, I believe asterisk continues
> > >>> to evaluate this condition as true for 2 more minutes.
> > >>>
> > >>> So in this case, it will be valid for 00:00-12:02, even though
> > >>> you’ve specified 12:00
> > >>>
> > >>> Cheers!
> > >>>
> > >>> Neeraj
> > >>
> > >> Post a few hours ago..
> > >>
> > >> "Actually, that's 12:02, because times before 1.6.2 are only accurate
> > >> down
> > >> to the 2-minute interval.  So 12:01 is treated the same as 12:00.
> > >> Starting
> > >> with 1.6.2, times are accurate down to the minute."
> > >
> > > Hmm, I would still consider it a bug, whether on 1 or 2 minute
> > > resolution. The example condition should start being true at 00:00
> > > exactly, and stop being true at 12:00 exactly. So at 12:00:01 it should
> > > NOT match:
> > >
> > > if (now >= start_time && now < end_time)
> > >
> > > This then is independent of the resolution, provided the end time is an
> > > exact multiple of that resolution.
> > >
> > > After all, if a shop shuts at 5pm prompt, and you get there at 10
> > > seconds after 5pm, it is shut, not open until 5:00:59.999999 or
> > > whenever.
> > >
> > > -----------------------------------------------------------------------
> > >-
> >
> > We're talking precision here, though. With a 2-minute precision, you
> > have to understand that there IS no 12:00:01 as far as Asterisk is
> > concerned. There is simply 12:00 and 12:02. At exactly 12:00, it
> > evaluates true, just as has been put in the if statement. It checks
> > again at 12:02 and it evaluates false.
>
> I think you have missed what I was saying.
>
> I was saying that comparing with 12:00 should NOT evaluate true.
>
> If you think of set theory, the lower bound (e.g. 00:00) should be
> a closed boundary, and the upper bound (e.g. 12:00) should be an
> open boundary.

Regardless of how you think it should work, the poster above described
precisely the way it works.  If your end boundary is 12:00, it will evaluate
as true all the way up until 12:01:59.  If you don't want that, another poster
has suggested using 11:59, which will work fine.

Given backwards compatibility concerns, this is unlikely to change.

-- 
Tilghman & Teryl
with Peter, Cottontail, Midnight, Thumper, & Johnny (bunnies)
and Harry, BB, & George (dogs)



More information about the asterisk-users mailing list