(Page 27 of 80 in this chapter)
adiGetTimeStamp
Description
- Converts an event timestamp to a count of the seconds elapsed since January 1, 1970.
Prototype
- DWORD adiGetTimeStamp( unsigned drvid,
DWORD msgtime,
unsigned long *timesec,
unsigned *timems )
- drvid Driver ID returned from adiOpenDriver
- msgtime The event time stamp.
- timesec Returned seconds.
- timems Returned milliseconds.
Return Values
Events
- None.
Details
- This function converts an event timestamp to a count of the number of seconds elapsed since 00:00:00 January 1, 1970. The msgtime is the ADI_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.
Note: 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( unsigned drvid, ADI_EVENT *event )
{
struct tm *ptime;
unsigned long timesec;
unsigned timems;
adiGetTimeStamp( drvid, event->timestamp, ×ec, &timems );
ptime = localtime( ×ec );
printf( "%02d:%02d:%02d.%03d\n",
ptime->tm_hour, ptime->tm_min, ptime->tm_sec, timems );
}
(Page 27 of 80 in this chapter)
Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights
reserved.