<< Click to Display Table of Contents >> Navigation: 3. Script Language > Date and Time Calculation > TCA. - Time Calculation > TCA.Diff |
MiniRobotLanguage (MRL)
TCA.Diff - Command
Subtracts 2 Timestamps
Intention
Using TCA.Diff you can easily Subtracts Timestamps in this Standard-Format:
HH:MM:SS.ddd
Hereby the
- HH is Hours (0 to 99 - not limited to 12 or 24)
- MM is the Minutes limited 59
- SS is the Seconds limited 59
- ddd is the Milliseconds limited to 999
The Format of the Milliseconds is internally rounded to 3 places by prefixing zeroes.
If you specify 00:00:23 this will be treated as 00:00:00.023
If you specify 00:00:00.023 this will be treated as 00:00:00.023
If the result of any of the values goes beyond their limit, the Carry is added to the next higher Parameter.
If the result is smaller then P1, the result will roll over to the previous time.
' Here P1 is smaller then P2, therefore the result will roll over
$$LAA=01:24:12.001
$$LAB=02:50:13.002
$$ERG=22:33:58:999
$$MSG=Teste TCA. 4
TCA.Dif|$$LAA|$$LAB|$$LAC
MBX.$$LAC
NAT.@$$LAC|$$ERG
GTO.Lab_failed
EIF.
ENR.
' Here P1 is larger then P2 threrfore this is a normal Subtraction
$$LAA=02:50:13.002
$$LAB=01:24:12.001
$$ERG=01:26:01:001
$$MSG=Teste TCA. 4
TCA.Dif|$$LAA|$$LAB|$$LAC
MBX.$$LAC
NAT.@$$LAC|$$ERG
GTO.Lab_failed
EIF.
ENR.
Syntax
TCA.Diff|P1|P2[|P3]
TCA.Dif|P1|P2[|P3]
Parameter Explanation
P1 - Timestamp A
P2 - Timestamp B
P3 - Variable for Result Timestamp. If omitted the result is placed on TOS.
Example
'**********************************************
' TCA.Dif - Sample
'**********************************************
'
$$LAA=08:11:12.124
$$LAB=12:11:12.123
$$ERG=20:00:00.001
$$MSG=Teste TCA. 1
TCA.Dif|$$LAA|$$LAB|$$LAC
NAT.@$$LAC|$$ERG
MBX.Result is wrong.
ELS.
MBX.Result is $$ERG
EIF.
ENR.
Remarks
-
Limitations:
-
See also:
• DAT. - Date and Time Information (System independent)
• DTC. - Date and Time Calculation
• IDC. / NDC. - If Date Command
• CAL. - mathematical CALculation