Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title How to use clock ticks in code.
Ref. No. QNX.000009422
Category(ies) Development
Issue In QNX4, using Watcom 10.6, how do you tell when the clock has ticked to a new second?

And how do you start a function on the start of a new second?
Solution To tell if its a new second:
--
x = tptr->seconds;
while (tptr->seconds == x);
--
You have to load the structure with the time before this code.

To start something on a new second:
--
while (tptr->nsec&1);
--
using nsec gives you the best resolution possible using the time functions.