<< Click to Display Table of Contents >> Navigation: 3. Script Language > Date and Time Calculation > IAT. / NAT. - If After Timestamp |
MiniRobotLanguage (MRL)
IAT. / NAT. Conditional Statement
If After Timestamp / If NOT After Timestamp
Intention
What is a TimestamP
A Timestamp is a Time-Value in the Format: HH:MM:SS or HH:MM:SS.mmm
Using the TCA. and these other Time-Stamp Commands you can work with Timestamps.
IAT. will need two timestamps as Parameter. It will then compare both Timestamps and decide
if Timestamp P1 is AFTER Timestamp P2.
If Timestamp P1 is equal to Timestamp P2 then the time P1 is NOT After P2.
If you specify an @ Sign in front of P1 then the statement will evaluate if P1 = P2 means If Timestamp 1 is equal to Timestamp 2 instead.
In case of an error, the IAT. will by default evaluate to true, but will raise an error on TOS.
Hint: $time$ will return a timestamp like: 12:01:40
If one or both Parameters include ".000" Microseconds, then these will also be evaluated.
If Microseconds are missing, they will be ignored.
The negative Form of this statement is NAT.
Here is the special Mode that uses the @ Operator.
And the other case:
Syntax
IAT.[@]P1|P2 ... ELS. ... EIF.
NAT.[@]P1|P2 ... ELS. ... EIF.
Parameter Explanation
P1 - Timestamp 1 that needs to be AFTER P2 for this to evaluate to TRUE.
If you specify an @ Sign in front of P1 then the statement will evaluate if P1 = P2 means If Timestamp 1
is equal to Timestamp 2 instead.
P2 - Timestamp 2
Example
'**********************************************
' IAT. - Sample
' Timeloop will produce Timestamps with an Intervall
'**********************************************
'
$$TIA=08:09:59.000
$$TIB=08:10:01.000
$$LOP=$$TIA
$$INC=00:00:00.010
$$LOV=0
DOL.
TCA.Add|$$LOP|$$INC|$$LOP
PRT.Looping: $$LOP
IAT.$$LOP|$$TIB
$$LOV=1
EIF.
OOP.$$LOV
MBX.$$LOP
ENR.
'**********************************************
' IAT. - Sample Macros
'**********************************************
':Insert_TPS
$$EIN=00:00:01
$$ZWO=00:00:03
VAN.$$CNT=0
TCA.Add|$$TIA|$$EIN|$$STA
TCA.Dif|$$TIB|$$ZWO|$$ENA
%FOT $$STA|$$ENA|$$EIN
VIC.$$CNT
$$TIM=$$LOP
%NXT
RET.
'-----------------------------------------------------------
' These two Macros define a Timestamp-FOR Loop
' So you can Loop from P1 to P2 using Step P3
'
: %FOT 3
$$FOA=§§§01
$$FOB=§§§02
$$FOC=§§§03
$$LOP=$$FOA
DOL.
'EIF-
END%
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'
: %NXT
TCA.Add|$$LOP|$$FOC|$$LOP
BCH.$$LOP|.|1|$$TOP
BCH.$$FOB|.|1|$$BOP
IAT.$$TOP|$$BOP
$$LOV=1
ELS.
$$LOV=0
EIF.
PRT.$$TOP / $$BOP ($$LOV)
OOP.$$LOV
'EIF+
END%
Remarks
-
Limitations:
-
See also: