clock resolution

I’m porting code from QNX4 to QNX6, and I’ve been trying to set the clock
resolution using ClockPeriod(CLOCK_REALTIME,&clock_period,NULL,0), which the
migration guide states is the Neutrino equivalent to clock_setres() in QNX4.

I’m trying to set the clock resolution to 499504 ns, which is the clock
resolution for Intel chips. ClockPeriod() returns an EINVAL, though, when I
try to do this. Is there another way of setting the clock resolution that
I’m unaware of? If not, does anyone know how to get around the fact that
Intel chip resolution is different from the smallest clock period allowable
in QNX6?

Thanks in advance.

-Tom

Tom Worsnopp <GreyCloak@northwestern.edu> wrote:

I’m porting code from QNX4 to QNX6, and I’ve been trying to set the clock
resolution using ClockPeriod(CLOCK_REALTIME,&clock_period,NULL,0), which the
migration guide states is the Neutrino equivalent to clock_setres() in QNX4.

I’m trying to set the clock resolution to 499504 ns, which is the clock
resolution for Intel chips. ClockPeriod() returns an EINVAL, though, when I
try to do this. Is there another way of setting the clock resolution that
I’m unaware of? If not, does anyone know how to get around the fact that
Intel chip resolution is different from the smallest clock period allowable
in QNX6?

sigh

Try asking for 500000 ns. It will, I expect, give you 499504, but
if you ask for 499504, it won’t give you that.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

David Gibbs <dagibbs@qnx.com> wrote:

Tom Worsnopp <> GreyCloak@northwestern.edu> > wrote:
I’m porting code from QNX4 to QNX6, and I’ve been trying to set the clock
resolution using ClockPeriod(CLOCK_REALTIME,&clock_period,NULL,0), which the
migration guide states is the Neutrino equivalent to clock_setres() in QNX4.

I’m trying to set the clock resolution to 499504 ns, which is the clock
resolution for Intel chips. ClockPeriod() returns an EINVAL, though, when I
try to do this. Is there another way of setting the clock resolution that
I’m unaware of? If not, does anyone know how to get around the fact that
Intel chip resolution is different from the smallest clock period allowable
in QNX6?

sigh

Try asking for 500000 ns. It will, I expect, give you 499504, but
if you ask for 499504, it won’t give you that.

Yup, that’s a known bug. It won’t take its own output back as input :frowning:

Been there, done that :slight_smile:

Cheers,
-RK


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.