EDM01-02: DAG 4.2S Card User Guide
©2005
34
Version 7: May 2006
7.2 Timestamps
Description
The ERF format incorporates a hardware generated timestamp of the
packet’s arrival.
The format of this timestamp is a single little-endian 64-bit fixed point
number, representing seconds since midnight on the first of January 1970.
The high 32-bits contain the integer number of seconds, while the lower
32-bits contain the binary fraction of the second. This allows an ultimate
resolution of 2
-32
seconds, or approximately 233 picoseconds.
Another advantage of the ERF timestamp format is that a difference
between two timestamps can be found with a single 64-bit subtraction. It
is not necessary to check for overflows between the two halves of the
structure as is needed when comparing Unix time structures, which is also
available to Windows users in the Winsock library.
Different DAG cards have different actual resolutions. This is
accommodated by the lowermost bits that are not active being set to zero.
In this way the interpretation of the timestamp does not need to change
when higher resolution clock hardware is available.
Example code
Here is some example code showing how a 64-bit ERF timestamp (erfts)
can be converted into UNIX struct timeval representation (tv).
unsigned long long lts;
struct timeval tv;
lts = erfts;
tv.tv_sec = lts >> 32;
lts = ((lts & 0xffffffffULL) * 1000 * 1000);
lts += (lts & 0x80000000ULL) << 1; /* rounding */
tv.tv_usec = lts >> 32;
if(tv.tv_usec >= 1000000) {
tv.tv_usec -= 1000000;
tv.= 1;
}
Содержание DAG 4.2S
Страница 1: ......
Страница 5: ...EDM01 02 DAG 4 2S Card User Guide 2005 ii Version 7 May 2006...
Страница 9: ...EDM01 02 DAG 4 2S Card User Guide 2005 4 Version 7 May 2006...
Страница 35: ...EDM01 02 DAG 4 2S Card User Guide 2005 30 Version 7 May 2006...