Converts an event timestamp to a count of the seconds elapsed since January 1, 1970.
AG
CG
DWORD adiGetTimeStamp ( CTAHD ctahd, DWORD msgtime, unsigned long *timesec, unsigned *timems)
|
Argument |
Description |
|
ctahd |
Context handle returned by ctaCreateContext or ctaAttachContext. |
|
msgtime |
Event time stamp. |
|
timesec |
Pointer to returned seconds. |
|
timems |
Pointer to returned milliseconds. |
|
Return value |
Description |
|
SUCCESS |
|
|
CTAERR_INVALID_CTAHD |
Context handle is invalid. |
|
CTAERR_SVR_COMM |
Server communication error. |
Use adiGetTimeStamp to convert an event timestamp to a count of the number of seconds elapsed since 00:00:00 January 1, 1970. The msgtime is the CTA_EVENT timestamp value, which is in millisecond units with a 10-millisecond resolution. This function converts the msgtime into timesec seconds and timems milliseconds since midnight 1/1/70.
Because the event timestamp is 32 bits, it wraps every 232 milliseconds (about 49 days). adiGetTimeStamp assumes the event occurred within 24 days.
#include <time.h>
void myShowTime( CTAHD ctahd, CTA_EVENT *event )
{
struct tm *ptime;
unsigned long timesec;
unsigned timems;
adiGetTimeStamp( ctahd, event->timestamp, ×ec, &timems );
ptime = localtime( ×ec );
printf( "%02d:%02d:%02d.%03d\n",
ptime->tm_hour, ptime->tm_min, ptime->tm_sec, timems );
}