LibCommon_Time.ttcn 2.55 KB
Newer Older
/*
 *  @author   ETSI STF 276
 *  @version  $Id$
 *  @desc     A collection of time handling functions which may be useful in
 *            the implementation of any TTCN-3 test suite.
 *  @remark   End users should be aware that any changes made to the  in
 *            definitions this module may be overwritten in future releases.
 *            End users are encouraged to contact the distributers of this
 *            module regarding their modifications or additions so that future
 *            updates will include your changes.
 */
mullers's avatar
mullers committed
module LibCommon_Time {

  group timeLibModuleParameters {

    /* @desc    Time to control PTC.stop
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar {float PX_TDONE := 120.0}

    /* @desc    Time to control the reception of a message
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar {float PX_TAC := 30.0}

    /* @desc    Time to control that IUT sends nothing
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar {float PX_TNOAC := 10.0}

    /* @desc    Time to control that IUT reacts prior to Upper Tester action
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar {float PX_TWAIT := 120.0}

    /* @desc    Time to control sending in loops
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar {float PX_LOOP := 1.0}

  } // end group timeLibModuleParameters

  group sleeping {

    /*
     * @desc  The invocation of this function will cause a test component
     *        to sleep (or wait) for a specified amount of time.
     *        Defaults may interrupt this sleep if activated.
     * @see   LibCommon_Time.f_sleepIgnoreDef
     * @param p_duration Amount of time that the test component should wait.
     */
    function f_sleep ( in float p_duration ) {
      timer t;
      if (p_duration <= 0.0) {return}
      t.start( p_duration );
      t.timeout;
    }

    /*
     * @desc  The invocation of this function will cause a test component
     *        to sleep (or wait) for a specified amount of time.
     *        This function ignores any active defaults, i.e., the function
     *        will always wait the specified amount of time.
     * @param p_duration Amount of time that the test component should wait.
     */
    function f_sleepIgnoreDef ( in float p_duration ) {
      timer t;
      if (p_duration <= 0.0) {return}
      t.start( p_duration );
      alt {
        [] t.timeout {}
        [else] {repeat}
      } // end alt
    }

  } // end group sleeping

} // end module LibCommon_Time