Hello,
Does anyone know of a fast method to retrieve the number of clock ticks that
have elapsed since QNX was started?
Thanks,
Pat.
Hello,
Does anyone know of a fast method to retrieve the number of clock ticks that
have elapsed since QNX was started?
Thanks,
Pat.
Pat <pmiles@cgocable.net> wrote:
Hello,
Does anyone know of a fast method to retrieve the number of clock ticks that
have elapsed since QNX was started?
I can’t see an accurate way to get this – the big problem being that the
ticksize can be changed dynamically, and we don’t ever count the number
of actual clock interrupts – we just move time forward.
Also, I don’t see a way to get it more accurately than to the nearest
second’s worth of ticks – though I may be missing something.
To figure it out:
qnx_psinfo(PROC_PID, PROC_PID, &psinfo_data, NULL );
psinfo_data.un.proc.start_time
is the boot time for the system
clock_getres() will give you the ticksize
clock_gettime() will give the current time
(current_time - boot_time) * ticks_per_second will give you
approximate number of clock ticks since boot time.
But, what are you trying to figure out/achieve here?
Why, in particular, do you need it in clock ticks?
QNX Training Services
dagibbs@qnx.com
Previously, David Gibbs wrote in comp.os.qnx:
Pat <> pmiles@cgocable.net> > wrote:
Hello,Does anyone know of a fast method to retrieve the number of clock ticks that
have elapsed since QNX was started?I can’t see an accurate way to get this – the big problem being that the
ticksize can be changed dynamically, and we don’t ever count the number
of actual clock interrupts – we just move time forward.
Well if that is the actual requirement, it would be fairly easy to
attach a progra to Interrupt 0 and count the ticks yourself.
Mitchell Schoenbrun --------- maschoen@pobox.com
Hi David,
My thanks for your response.
I was hoping for a 32 bit clock tick count that I could access atomically
(and quickly). It occurred to me that such an entity would be an easy way
of time synchronization of events in multiple processes at various
priorities.
Pat.