latch_object.Timestamp Property

Read-only property that returns the time when an encoder latch occurred.

latch_object.Timestamp( select )

Prerequisites

Requires that the Encoder Latching or Advanced Controls or Conveyor Tracking License be installed on the controller.

Parameters

select

An optional numeric value that selects the reference time for the value returned.  Set to 0 to return the seconds since January 1, 1988 according to the time-of-day setting.  Set to 1 to return the seconds since this controller was booted.  If omitted, the value 0 is assumed.

Remarks

This read-only property returns the timestamp that indicates when the latch_object's encoder position latch was triggered. This timestamp is a Double value, consistent with the Controller.Timer(select) property.

Timestamp(0) values are the number of seconds since January 1, 1988 and are accurate to within 1 µsec. Given the number of significant bits in a Double value, this time value will not lose accuracy until the year 2124. If you change the time-of-day (using the Date command, the web interface, or DataID 121) this time value will be modified. So, Timestamp(0) may be inaccurate if the time-of-day is changed while latch operations are occurring and is therefore not recommended.

Timestamp(1) values are the number of seconds since the controller was booted. Changing the time-of-day does not affect this value. This is the preferred method for retrieving encoder latch times.

Latch results are returned by the Latch.Result method in the order that they were received, with the oldest results returned first. The Timestamp property can be used to determine the order of latch results received from different queues, or to compute the elapsed time between latches. However, Timestamp(0) may be inaccurate or the order may appear wrong if the time-of-day is changed while latch operations are occurring.

The accuracy of the Timestamp depends on the type of digital input signal that triggered the latching. For information on the accuracy and latencies for each type of digital input signal, please refer to the PreciseFlex Library > Controller Software > Introduction to the Software > Communications > Digital Inputs and Outputs > Latch Input > Latch Timing.

Examples

                Dim lat1, lat2 As Latch
Dim difference As Double
lat1 = Latch.Result(1) ' First latch
lat2 = Latch.Result(1) ' Second latch
difference = lat2.Timestamp(1) - lat1.Timestamp(1)
Console.WriteLine("Difference: " & CStr(difference))

See Also

Latch Class|Controller.Timer