TCA.Between

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Date and Time Calculation > TCA. - Time Calculation >

TCA.Between

TCA.Between Timestamps

Previous Top Next


MiniRobotLanguage (MRL)

 

TCA.Betweeen - Command

Get Time between 2 Timestamps

 

 

Intention

 

With TCA.Between you can get the exact time between two 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.23 this will be treated as 00:00:00.023

 

The result will be the same if the second parameter P2 is larger (later) than P1 or earlier.

 

 

Sample: Between (Get Timestamp between 2 Timestamps)

 

' Simple Example
$$LAA=00:00:00.000

' Technically the robot works with 12:00:00:002

$$LAB=12:00:00.2

TCA.Bet|$$LAA|$$LAB|$$LAC

' Result is  06:00:00:001

MBX.$$LAC

ENR.

 

' Difficult Example

$$LAA=23:59:36.740

$$LAB=12:00:00.212

TCA.Bet|$$LAA|$$LAB|$$LAC

' Result is  17:59:58:476

MBX.$$LAC

ENR.

 

' Simpler Example

$$LAA=10:00:00.000

$$LAB=20:20:10.500

TCA.Bet|$$LAA|$$LAB|$$LAC

' Result is  15:10:05:250

MBX.$$LAC

ENR.

 

 

 

 

Syntax

 

TCA.Bet|P1|P2[|P3]

TCA.Between|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. - Sample

'**********************************************

'

$$LAA=03:11:11.111

$$LAB=05:55:55.555

$$ERG=04:33:33.333

$$MSG=Teste TCA.Between

TCA.Bet|$$LAA|$$LAB|$$LAC

NAT.@$$LAC|$$ERG

 MBX.Result is wrong.

ELS.

 MBX.Result is $$ERG

EIF.

ENR.

 

 

'**********************************************

' TCA. / IAT. - Sample

' Timeloop will produce Timestamps with an Interval

'**********************************************

'

$$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.

 

 

Remarks

 

-

 

 

 

Limitations:

-

 

 

See also:

 

    1.5.1.3. Using Variables

    DAT. - Date and Time Information (System independent)

    VTT. - Value to Time

    TTV. - Time to Value

    VTD. - Value to Date

    DTC. - Date and Time Calculation

    VTF. - Verify Time Format

    VDF. - Verify Date Format

    IDC. / NDC. - If Date Command

    CAL. - mathematical CALculation

    CAX. - Calculate Extended