TIME/LTIME Constants

Overview

TIME constants are used to operate the standard timer modules. The time constant TIME is of size 32 bit, resolution in milliseconds as specified by the IEC 61131-3 standard. Additionally, LTIME is supported as an extension to the standard as time base for high-resolution timers. LTIME is of size 64 bit and provides a resolution in nanoseconds.

The library standard64.lib provides functions for WSTRING strings.

Syntax for TIME Constant

t#<time declaration>

Instead of t#, you can also use the following:

  • T#

  • time#

  • TIME#

The time declaration can include the following time units. They have to be used in the following sequence, but it is not required to use all of them.

  • D | d: days

  • H | h: hours

  • M | m: minutes

  • S | s: seconds

  • MS | ms: milliseconds

Examples of correct TIME constants in an ST assignment

Example

Description

TIME1 := T#14ms;

TIME1 := T#100S12ms;

(* The highest component may be allowed to exceed its limit *)

TIME1 := t#12h34m15s;

Examples of incorrect usage

Example

Description

TIME1 := t#5m68s;

(* limit exceeded in a lower component *)

TIME1 := 15ms;

(* T# is missing *)

TIME1 := t#4ms13d;

(* incorrect order of entries *)

Syntax for LTIME Constant

LTIME#<time declaration>

The time declaration can include the time units as used with the TIME constant and additionally:

  • us: microseconds

  • ns: nanoseconds

Examples of correct LTIME constants in an ST assignment:

LTIME1 := LTIME#1000d15h23m12s34ms2us44ns
LTIME1 := LTIME#3445343m3424732874823ns

For further information, refer to the description of the Date and Time Data Types.