# ctaGetTimeStamp

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

#### Prototype

DWORD ctaGetTimeStamp ( DWORD msgtime, unsigned long *timesec, unsigned *timems)

Argument | Description
msgtime | The event timestamp.
timesec | Pointer to the returned seconds.
timems | Pointer to the returned milliseconds.

#### Return values

SUCCESS

#### Details

ctaGetTimeStamp converts 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. This function converts the msgtime into timesec seconds and timems milliseconds since midnight 1/1/70.

Note: Because the event timestamp is 32 bits, it wraps every 232 milliseconds (about 49 days). ctaGetTimeStamp assumes the event occurred within 24 days.

#### Example

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