How to Convert the Device Timestamp to Relative Time¶
The timestamp is a high-resolution monotonic time counter based on the instrument’s reference clock with the FPGA time resolution. It is a 64-bit unsigned integer reported by the instrument during data acquisition. It serves as time reference for all measurements performed on the device, i.e. the time axis of all measurements must be based on the corresponding timestamps of the acquired data.
The timestamp counter starts at 0
when the instrument is switched on, and then it counts up monotonically with a time resolution obtained from the device node /dev..../system/properties/timebase
. This time resolution depends on the instrument type, for instance, the timestamp of the UHFLI Lock-in Amplifier has a resolution of 555.56 ps corresponding to a count rate of 1.8 GHz, while the timestamp resolution of the MFLI Lock-in Amplifier is 16.67 ns corresponding to a count rate of 60 MHz.
Every time the instrument goes through a power cycle, its timestamp resets to 0
; therefore, it has no relation with the System Time of the host computer. It should only be used to calculate the time interval between internal events that happen on the instrument, e.g. time difference between two signal samples.
To convert an array of timestamp ticks to an array of relative time instances in seconds, the following logic can be used. The code snippet is in Python but it can be easily translated to other API languages such as MATLAB, C, etc.
# Read the time resolution of device timestamp
dt = daq.getDouble('/dev1000/system/properties/timebase')
# Convert the timestamp to relative time in seconds
t = (timestamp – timestamp[0]) * dt
In this code snippet, dt
is the time resolution between two consecutive timestamp ticks, timestamp
is an array of acquired timestamps, and t
is the relative time in seconds suitable for the time axis of signal plots.
The timestamp of multiple instruments is independent and not automatically synchronized. To synchronize timestamps among devices of the same type, their Multi-Device Synchronization (MDS) feature can be employed. The LabOne MDS Module provides an easy interface to use the MDS capability of instruments.