[22] | 1 | /**
|
---|
| 2 | * @author ETSI
|
---|
| 3 | * @version $URL: svn+ssh://vcs.etsi.org/TTCN3/LIB/Ttcn3LibCommon/trunk/ttcn/LibCommon_Time.ttcn $
|
---|
| 4 | * $Id: LibCommon_Time.ttcn 29 2008-11-24 10:08:08Z mullers $
|
---|
| 5 | * @desc A collection of time handling functions which may be useful in
|
---|
| 6 | * the implementation of any TTCN-3 test suite.
|
---|
| 7 | * @remark End users should be aware that any changes made to the in
|
---|
| 8 | * definitions this module may be overwritten in future releases.
|
---|
| 9 | * End users are encouraged to contact the distributers of this
|
---|
| 10 | * module regarding their modifications or additions so that future
|
---|
| 11 | * updates will include your changes.
|
---|
| 12 | */
|
---|
| 13 | module LibCommon_Time {
|
---|
| 14 |
|
---|
| 15 | group timeLibModuleParameters {
|
---|
| 16 |
|
---|
| 17 | /**
|
---|
| 18 | * @desc Time to control PTC.stop
|
---|
| 19 | * @remark PICS/PIXIT Reference: XXX
|
---|
| 20 | */
|
---|
| 21 | modulepar {float PX_TDONE := 120.0}
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * @desc Time to control the reception of a message
|
---|
| 25 | * @remark PICS/PIXIT Reference: XXX
|
---|
| 26 | */
|
---|
| 27 | modulepar {float PX_TAC := 30.0}
|
---|
| 28 |
|
---|
| 29 | /**
|
---|
| 30 | * @desc Time to control that IUT sends nothing
|
---|
| 31 | * @remark PICS/PIXIT Reference: XXX
|
---|
| 32 | */
|
---|
| 33 | modulepar {float PX_TNOAC := 10.0}
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * @desc Time to control that IUT reacts prior to Upper Tester action
|
---|
| 37 | * @remark PICS/PIXIT Reference: XXX
|
---|
| 38 | */
|
---|
| 39 | modulepar {float PX_TWAIT := 120.0}
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | * @desc Time to control sending in loops
|
---|
| 43 | * @remark PICS/PIXIT Reference: XXX
|
---|
| 44 | */
|
---|
| 45 | modulepar {float PX_LOOP := 1.0}
|
---|
| 46 |
|
---|
| 47 | } // end group timeLibModuleParameters
|
---|
| 48 |
|
---|
| 49 | group sleeping {
|
---|
| 50 |
|
---|
| 51 | /**
|
---|
| 52 | * @desc The invocation of this function will cause a test component
|
---|
| 53 | * to sleep (or wait) for a specified amount of time.
|
---|
| 54 | * Defaults may interrupt this sleep if activated.
|
---|
| 55 | * @see LibCommon_Time.f_sleepIgnoreDef
|
---|
| 56 | * @param p_duration Amount of time that the test component should wait.
|
---|
| 57 | */
|
---|
| 58 | function f_sleep ( in float p_duration ) {
|
---|
| 59 | timer t;
|
---|
| 60 | if (p_duration <= 0.0) {return}
|
---|
| 61 | t.start( p_duration );
|
---|
| 62 | t.timeout;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | /**
|
---|
| 66 | * @desc The invocation of this function will cause a test component
|
---|
| 67 | * to sleep (or wait) for a specified amount of time.
|
---|
| 68 | * This function ignores any active defaults, i.e., the function
|
---|
| 69 | * will always wait the specified amount of time.
|
---|
| 70 | * @param p_duration Amount of time that the test component should wait.
|
---|
| 71 | */
|
---|
| 72 | function f_sleepIgnoreDef ( in float p_duration ) {
|
---|
| 73 | timer t;
|
---|
| 74 | if (p_duration <= 0.0) {return}
|
---|
| 75 | t.start( p_duration );
|
---|
| 76 | alt {
|
---|
| 77 | [] t.timeout {}
|
---|
| 78 | [else] {repeat}
|
---|
| 79 | } // end alt
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | } // end group sleeping
|
---|
| 83 |
|
---|
| 84 | } // end module LibCommon_Time
|
---|