[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

1319.0. "mcc_ats_get_previous question" by TENERE::LAVILLAT () Wed Aug 07 1991 08:41

Another question on MCC_ATS routines.

I have now a problem with the mcc_ats_get_previous routine.

I simply want to check if a specified instant time (say T) is within a time
frame or not.

To do that, I set the context time to T using mcc_ats_set_current for both the
SCHEDULE and SCOPE part of my time frame and then call mcc_ats_get_previous to
retrieve start time and end time of the previous scope. I then decide that T is
inside the time frame if T is less than end time.

I have done a test with a time frame that express :
"AT start NOW every 7 days, FOR start in 2 hours , end in 8 hours"

I got expected result when I specify a time instant T that is within the 
current week, but if T is a future instant in more than a week, it seems that 
mcc_ats_get_previous does not see the one week periodicity expressed in the
schedule part.

Here is a log of my test (I use a DISABLE verb, with a time argument that
carry my T value, and send back begin/end time got from mcc_ats_get_previous) :

RIVAGE_$ mana/ent
DECmcc (V1.1.0)

MCC> disa os a t a i 1 time = 15:00
time frame at 2b2ff4 hex
schedule
   contains 1 elements
   element 0
      begin is ABSOLUTE:  7-AUG-1991 11:32:06.18
      end is ABSOLUTE:  7-AUG-1991 11:32:06.18
      periodicity: 7 00:00:00.00
      period_end:  1-DEC-1991 00:00:00.00
scope
   contains 1 elements
   element 0
      begin is RELATIVE: + 0 02:27:54.00
      end is RELATIVE: + 0 06:27:54.00
      periodicity is NULL
      period_end is NULL
Till now 8873.990234

OSI_SYSTEM TENERE_NS:.a TESTOBJ "a" ITEM 1
AT  7-AUG-1991 11:32:06

Entity successfully DISABLEd.
                             Begin Time =  7-AUG-1991 14:00:00.36,
                               End Time =  7-AUG-1991 18:00:00.36,
                                  Is On = True
MCC> disa os a t a i 1 time = 14-aug 15:00
time frame at 2b2b48 hex
schedule
   contains 1 elements
   element 0
      begin is ABSOLUTE:  7-AUG-1991 11:32:15.17
      end is ABSOLUTE:  7-AUG-1991 11:32:15.17
      periodicity: 7 00:00:00.00
      period_end:  1-DEC-1991 00:00:00.00
scope
   element 0
      begin is RELATIVE: + 0 02:27:45.00
      end is RELATIVE: + 0 06:27:45.00
      periodicity is NULL
      period_end is NULL
Till now 8865.000000

OSI_SYSTEM TENERE_NS:.a TESTOBJ "a" ITEM 1
AT  7-AUG-1991 11:32:15

Entity successfully DISABLEd.
                             Begin Time =  7-AUG-1991 14:00:00.44,
                               End Time =  7-AUG-1991 18:00:00.44,
                                  Is On = False
MCC>


Any idea ?

Should I specify also in the SCOPE part of my time frame a 7 days periodicity,
instead of NULL ?

Regards.

Pierre.
T.RTitleUserPersonal
Name
DateLines
1319.1schedule and scope are separateTOOK::T_HUPPERThe rest, as they say, is history.Thu Aug 08 1991 12:1181
    The schedule and scope parts of a time frame are more independent than
    what you assume.  For all the mcc_ats_get_* routines, a relative scope
    of interest is evaluated against the CURRENT scheduled time, or against
    the current system time (sticky - obtained only once for relative
    evaulations until the next mcc_ahs_reinit or an mcc_ats_set_current) if
    there is no schedule time active.  A scope of interest evaluation does
    not take into account any of the schedule time components in the time
    frame itself.  It uses only the schedule time context that is contained
    within the handle parameter of the mcc_ats_get_* call for the scope of
    interest evaluation.  This is the time context that is set during the
    mcc_ats_set_current routine, or during an mcc_ats_get_* call, for the
    schedule time component.  An mcc_ats_get_* call for the scope of
    interest does not update in any way the schedule time context contained
    in the handle parameter.
    
    Therefore, what you need to do is perform an mcc_ats_get_* call for the
    schedule time component to set the schedule time context in the handle
    to the desired time.  Then perform the mcc_ats_get_first call (for a
    relative scope of interest there can only be a single time range (no
    periodicity) to get the beginning and ending time of the scope of
    interest.  Then compare the test time against the scope of interest
    beginning and end times.  Note that as the EVERY (periodicity) is
    contained only within the schedule time, an mcc_ats_get_* call must be
    made to move to the next period to evaluate the scope of interest (or
    do your own mcc_ats_set_current for the schedule time component).
    
    Now for the bad news:
    
    If you examine the description of the mcc_ats_link routine in the SRM,
    you will note that the UNTIL time is always ABSOLUTE.  This puts a
    severe crimp in the use of relative scope of interest times.  Given
    that the relative scope of interest times are evaluated relative to the
    schedule time (or current time if there is no schedule time in the
    handle), a relative scope of interest with a periodicity will always be
    terminated at the SAME absolute time, regardless on any periodicity. 
    If the schedule time also has a periodicity, the resulting evaluation
    becomes essentially useless.  For this reason, we are not supporting
    (at the user interface level) relative scopes of interest (FOR clauses)
    containing periodicity.  All periodicity MUST be done in the schedule
    time component of the time frame (AT clause at the user interface).
    
    Now for the worst news:
    
    The description above of how the relative scope of interest is
    evaluated against a schedule time context (or current time if there is
    no schedule time context) is how it SHOULD work.  Due to a bug in the
    mcc_ats_get_* code, a relative time is always evaluated against a
    sliding current time.  Each time the mcc_ats_get_* call is made, the
    then-current system time is obtained and used to evaluate the relative
    scope of interest.  Successive calls to mcc_ats_get_first for a
    relative scope of interest will always result in DIFFERENT scope of
    interest beginning and end absolute times.  There is nothing you can do
    to force it to use a base time that you specify.  This is being fixed
    for V1.2 as I write this (another engineer is doing it).  Then the
    relative scope of interest will be evaluated against a fixed base time,
    either the current schedule time or a snapshot of the current time that
    is used for all successive scope of interest evaluations (until a call
    to mcc_ahs_reinit for the handle or mcc_ats_set_current for the
    schedule time context is made).
    
    Therefore, in order to do the evaluation that you want, you should do
    an mcc_ats_get_first for the scope of interest to get the absolute
    beginning and end times (mcc_ats_get_* routines only return absolute
    times).  Quickly grab the current time with a call to
    mcc_time_get_current.  Subtract this current time from the beginning
    and end times to get relative beginning and end times.  These times
    will be approximately the same as those originally put into the time
    frame during the mcc_ats_link call.  Now you can do mcc_ats_get_* calls
    on your schedule time, add in the relative scope of interest beginning
    and end times yourself, and determine if the test time fall into the
    resulting time range.  This is a bit laborious.
    
    There are no plans to have scope of interest evaluations examine the
    schedule time component of the time frame.  We will continue to use
    only the schedule time context contained in the handle of the
    mcc_ats_get_* routines.  If you want to suggest a better plan, please do
    so.  We have no illusions that the scheme we have is perfect or even
    complete (witness the absolute UNTIL time in the mcc_ats_link routine,
    which is not currently scheduled for repair in V1.2).
    
    Ted
1319.2ThanksTENERE::LAVILLATFri Aug 09 1991 06:1010
Thanks for the detailed reply.

I will try to deal with with your bad and worst news.

At least I know how to do it now.

Regards.

Pierre.