Time Stamping
- Updated2025-12-08
- 2 minute(s) read
NI digitizers use a free-running timing clock and/or a time-to-digital converter (TDC) to accurately record the time of an event. For example, the NI 5114/5122/5124/5142/5922 each have a 64-bit counter. NI-SCOPE creates accurate time records by aligning the NI-TIO clock to the sample clock on your device. This time record is a time stamp. With time stamps, you can correlate multiple records or even multiple acquisitions. For example, you can use time stamps to determine the amount of time between acquisitions.
How Time Stamps Work
NI-SCOPE returns time stamps with every Fetch function, if the digitizer supports them, in the waveform info structure. This structure contains both absolute initial x and relative initial x parameters. The absolute initial x parameter is the time of the first point in the waveform in units of seconds, and it has a resolution of the maximum real-time sampling period of the digitizer (such as 10 ns for a 100 MS/s digitizer). This time is valid between records and entire acquisitions, provided the clock is not reset. The relative initial x parameter, which is supported by all digitizers, is the time between the first point in your waveform and the trigger. Therefore, the trigger always occurs at time equals zero. It includes the interpolated TDC. This conversion measures when the trigger occurs between two samples. Keep in mind that the relative initial x value is not valid until a trigger occurs when using continuous acquisition. To compute an absolute trigger time that includes the TDC value, use the following formula:
absolute trigger time = absolute initial x – relative initial x
The time it takes for the time stamp counter to roll over depends on the number of bits in the time stamp counter and the clock frequency. For instance, the rollover would occur for an NI 5114/5122/5124/5142/5922 if it runs for 5849 years. If the rollover occurs, NI-SCOPE returns a warning.
To reset the counter on the NI 5114/5122/5124/5142/5922, call niScope Reset.
Time Stamps Example
The Timestamps example uses time stamps to compute a histogram of the time between triggers. You can use this example to calculate the minimum time required between records. You can find the Timestamps example by using the shortcut Start»All Programs»National Instruments»NI-SCOPE»Examples.