MUL_LTIME

Multiplies a long duration by a number.

Note

This feature requires IEC 61131-3 Edition 3. Use --dialect iec61131-3-ed3 to enable it. See Enabling Dialects and Features for details.

Signature

     ┌───────────┐
IN1 ─┤           │
     │ MUL_LTIME ├─ OUT
IN2 ─┤           │
     └───────────┘
FUNCTION MUL_LTIME : LTIME
  VAR_INPUT
    IN1 : LTIME;
    IN2 : ANY_NUM;
  END_VAR
END_FUNCTION

The return type is LTIME.

Inputs

Name

Type

Description

IN1

LTIME

The duration to scale.

IN2

ANY_NUM

The numeric factor to multiply by.

Outputs

Name

Type

Description

Return value

LTIME

IN1 multiplied by IN2.

Description

Returns IN1 multiplied by the numeric value IN2. The result is an LTIME value. When IN2 is a floating-point type (REAL or LREAL), the product is computed as LREAL, so that no millisecond count is rounded to fit a REAL mantissa, and is truncated to whole milliseconds.

The short form is MUL_TIME. An operand of the short type (TIME where LTIME is expected) is accepted and widened to 64 bits.

Example

result := MUL_LTIME(LTIME#30d, 3);   (* result = LTIME#90d *)

See Also

References

  • IEC 61131-3 Edition 3, Table 30