Ascessing time on QNX system.

Hi,

Is there a structure in QNX that gives time precision up to milliseconds.
How can i get and set values in this structure?

Any other ideas for time management in QNX upto milliseconds.

Regards,
GK

There are several structures that give time precision up to milliseconds. Probably the easiest to use are the clock_gettime/clock_settime functions. You may also want to look at the timer functions such as timer_create to get notified after a certain period. Both these functions give you structures with nanosecond data. However, keep in mind that just because there’s nanosecond information in the structure doesn’t mean that you can accurately time things to the nanosecond.

Have a quick read of the timer and clock section from “Getting started with QNX Neutrino” qnx.com/developers/docs/6.4. … timer.html
and Understanding the microkernels concept of time: qnx.com/developers/docs/6.4. … iming.html

Steve

You can use for example: struct timeb & ftime. If you need to count time in msecs, this can help:

int diff_timeb_ms ( struct timeb end_time, struct timeb ini_time )
{
return (int) ( ( ( end_time.time + end_time.millitm / 1000.0 ) - ( ini_time.time + ini_time.millitm / 1000.0 ) ) * 1000.0 );
}

main ()
{
int mtime;

struct timeb ini_time, end_time;

ftime ( &ini_time );
something;
ftime ( &end_time );

mtime = diff_timeb_ms ( end_time, ini_time );
}