# timer

The keyword is used to declare timers in the module control part, test cases, functions and altsteps. These timers are considered as local.
Additionally, global timers can be declared in component type definitions.

- A timer declaration may have an optional default duration value assigned to it.
- It is possible to declare several timers with one keyword.

Related keywords:

- read
- running
- start
- stop
- timeout

### timer timer_identifier [:= default_value ];

- timer_identifier is the name used to refer to the timer. It must begin with a letter, may contain letters, numbers and underscore characters.
  According to the Naming convention, the following prefixes are recommended:

  - T_ for timers declared within component type definitions,

  - Tl_ for timers declared in test cases, functions, altsteps, block of statements or in the control part.

- default_value optionally states the value of the timer in seconds unless otherwise given in the statement start.
  Floating point values must be used.

It is possible to define an array of timers.

### timer timer_identifier [array_dimension] [:= default_value_list ];

- timer_identifier is the name used to refer to the timer. It must begin with a letter, may contain letters, numbers and underscore characters.

- array_dimension gives the number of timers to be defined.

- default_value optionally states the value array of the timers in seconds unless otherwise given in the statement start.
  Floating point values must be used.

Example 1:

timer T_tidsoevervakning;

The global timer T_tidsoevervakning is declared.

Example 2:

timer Tl_tiempo := 5.5E-2;

The local timer Tl_tiempo is declared and given the initial value 55 ms.

Example 3:

timer T_tempilo := 5E-3, T_tijd;

Two global timers are defined. T_tempilo gets the default value of 5 ms, whereas T_tijd has no default value.

Example 4:

timer Tl_temporisation[4] := {-, 1E-1, -, -, -};

The array of local timers declared is called Tl_temporisation and consists of five timers. The second timer has the default value of 100 ms, the others have no default value.

BNF definition of timer