I have recently started using QNX4.25 for controlling a robot
platform. In certain places, I would like to have access to a very
accurate (microsecond accuracy) real time clock.
On QNXRTP, for example, there is the ClockCycles() function, which
does what I want. In DJGPP, which is a DOS based gcc development
environment, there is a uclock() function call, which reads the main
board timer chips for accurate timing.
My searches of QNX4 documentation did not reveal any such facility, unfortunely.
However, I noticed that QNX also uses Timer 0 for generating its timer pulses.
My question is whether reading the value of that timer, in combination with
the clock_gettime() function would be a reasonable way to obtain the accuracy
I would like. Would reading Timer 0 mess up anything in the kernel? It seemed
to me like Timer 0 is initially setup in Mode 3, which decrements by 2 at every clock
cycle. However, when I use clock_setres(), it seems to put it in Mode 2. Is this
Also, is there any way to get something like the “count of system ticks” since
the start of the system? In conjunction with the value of Timer 0, that would
give me an accurate relative clock without much hassles.
Thanks for any ideas/suggestions on this.
Uluc SARANLI, Graduate Student Research Assistant
Advanced Technology Laboratory, The University of Michigan
Room 139, 1101 Beal Ave. Ann Arbor, MI 48109-2110
Tel : (734) 763-1572 Fax:(734) 763-1260
E-mail : email@example.com
URL : http://www.eecs.umich.edu/~ulucs