SUB_LDT_LDT¶
Returns the difference between two long date-and-times as a duration.
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 ─┤ │
│ SUB_LDT_LDT ├─ OUT
IN2 ─┤ │
└─────────────┘
FUNCTION SUB_LDT_LDT : LTIME
VAR_INPUT
IN1 : LDATE_AND_TIME;
IN2 : LDATE_AND_TIME;
END_VAR
END_FUNCTION
The return type is LTIME.
Inputs
Name |
Type |
Description |
|---|---|---|
|
|
The minuend date-and-time. |
|
|
The subtrahend date-and-time. |
Outputs
Name |
Type |
Description |
|---|---|---|
Return value |
|
IN1 minus IN2 as a duration. |
Description¶
Returns the difference IN1 minus IN2 as an LTIME duration in
milliseconds. The internal subtraction is in seconds, then converted to
milliseconds.
The short form is SUB_DT_DT. An operand of the short
type (DATE_AND_TIME where LDATE_AND_TIME is expected) is
accepted and widened to 64 bits.
Example¶
result := SUB_LDT_LDT(LDT#2000-01-01-01:00:00, LDT#2000-01-01-00:00:00);
(* result = LTIME#1h *)
See Also¶
SUB_DT_DT — the short form
SUB_LDATE_LDATE — difference between two long dates
ADD_LDT_LTIME — add a duration to a long date-and-time
References¶
IEC 61131-3 Edition 3, Table 30