<< Click to Display Table of Contents >> Navigation: 3. Script Language > Date and Time Calculation > TCA. - Time Calculation > TCA.Divide |
MiniRobotLanguage (MRL)
TCA.Divide - Command
Divide a Timestamp
Intention
Using TCA.Div you can easily divide 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 any of the values goes beyond their limit, the Carry is added to the next higher Parameter.
The Division is always an Integer Division, means if P2 is "2.5" then the Robot will use a "2".
The Hours are hereby not limited to 23 because this way you can also calculate working times.
$$LAA=30:14:12.900
$$LAB=2
TCA.Div|$$LAA|$$LAB|$$LAC
' Result is 15:07:06.450
MBX.$$LAC
ENR.
' Lets say the total amount of time to do the Job would be 45 Hours
' And you can use 5 Computers for it.
$$LAA=45:01:4.100
$$LAB=5
TCA.Div|$$LAA|$$LAB|$$LAC
' Result is 09:00:12.820
DBP.$$LAC
ENR.
Syntax
TCA.Divide|P1|P2[|P3]
TCA.Div|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.Div - Sample
'**********************************************
'
$$LAA=08:11:12.124
$$LAB=12
$$ERG=20:22:24.247
$$MSG=Teste TCA. 1
TCA.Div|$$LAA|$$LAB|$$LAC
' Result is 00:40:56.010
NAT.@$$LAC|$$ERG
MBX.Result is wrong.
ELS.
MBX.Result is $$ERG
EIF.
ENR.
Remarks
-
Limitations:
Its a Integer Division. You can not divide using FP Numbers like "3.5".
See also:
• DAT. - Date and Time Information (System independent)
• DTC. - Date and Time Calculation
• IDC. / NDC. - If Date Command
• CAL. - mathematical CALculation