SUB_LDT_LTIME¶
Subtracts a long duration from a long date-and-time.
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_LTIME ├─ OUT
IN2 ─┤ │
└───────────────┘
FUNCTION SUB_LDT_LTIME : LDATE_AND_TIME
VAR_INPUT
IN1 : LDATE_AND_TIME;
IN2 : LTIME;
END_VAR
END_FUNCTION
The return type is LDATE_AND_TIME.
Inputs
Name |
Type |
Description |
|---|---|---|
|
|
The date-and-time to offset. |
|
|
The duration to subtract. |
Outputs
Name |
Type |
Description |
|---|---|---|
Return value |
|
IN1 minus IN2. |
Description¶
Returns a new LDATE_AND_TIME that is IN1 moved back by the
duration IN2. The duration is converted from milliseconds to seconds
before being subtracted.
The short form is SUB_DT_TIME. An operand of the
short type (DATE_AND_TIME and TIME where LDATE_AND_TIME and
LTIME is expected) is accepted and widened to 64 bits.
Example¶
result := SUB_LDT_LTIME(LDT#2000-01-01-01:00:00, LTIME#1h);
(* result = LDT#2000-01-01-00:00:00 *)
See Also¶
SUB_DT_TIME — the short form
ADD_LDT_LTIME — add a duration to a long date-and-time
SUB_LDT_LDT — difference between two long date-and-times
References¶
IEC 61131-3 Edition 3, Table 30