# adiGetTimeStamp

Converts an event timestamp to a count of the seconds elapsed since January 1, 1970.

#### Supported board types

- AG

- CG

#### Prototype

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 values

Return value | Description
SUCCESS |
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_SVR_COMM | Server communication error.

#### Details

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.

#### Example

#include <time.h>
void myShowTime( CTAHD ctahd, CTA_EVENT *event )
{
struct tm *ptime;
unsigned long timesec;
unsigned timems;
adiGetTimeStamp( ctahd, event->timestamp, &timesec, &timems );
ptime = localtime( &timesec );
printf( "%02d:%02d:%02d.%03d\n",
ptime->tm_hour, ptime->tm_min, ptime->tm_sec, timems );
}