05/26/2015 9:37 PM
post113864
|
Hello,
You'll find the detailed answer and discussion you are looking for in the documentation article
"Tick, Tock: Understanding the Microkernel's Concept of Time" here:
http://www.qnx.com/developers/docs/am11/topic/com.qnx.doc.neutrino.prog/topic/timing.html
Specifically look at the sub-section "Oversleeping: errors in delays".
Regards,
Eric
|
|
|
06/02/2015 9:40 AM
post113898
|
Hi,
there is normally no problem to set the system resolution to 0.1 ms.
You can Use ClockPeriod(), to change this.
The default of 1 ms was a good system default 20 years ago.
-Michael
Am 26.05.2015 um 06:39 schrieb Divya Bettampady:
> Hello,
>
> I want to use QNX timer to get clock resolution in terms of millisecond. I am successful in getting resolution in
terms of integer values such as 32ms, 16ms, and even 1ms.
>
> But when I set the timer interval to 5.3ms, the timer times out in non-uniform intervals (5ms, 5ms, 6ms, 5ms....).
What might be the cause for this behavior?
>
> I set the timer parameters as shown below:
>
> struct itimerspec itime;
> struct _pulse pl;
> int rcvid;
> float ms_interval = 5.3;
>
> itime.it_value.tv_sec = 0;
> itime.it_value.tv_nsec = ms_interval * 1000000;
> itime.it_interval.tv_sec = 0;
> itime.it_interval.tv_nsec = ms_interval * 1000000;
> timer_settime(timer_id, 0, &itime, NULL);
>
> while(1)
> {
> rcvid = MsgReceive(chid, &pl, sizeof(pl), NULL);
> if (rcvid == 0)
> { /* we got a pulse */
> if (pl.code == TIMER_START_PULSE)
> {
> printf("we got a pulse from our timer\n");
> }
> }
> }
>
> I measure the timer interval uses kernel traces captured using tracelogger.
>
> Thank you in advance.
>
> Best Regards,
> Divya
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post113861
> To cancel your subscription to this discussion, please e-mail general-community-unsubscribe@community.qnx.com
>
>
|
|
|