System clock frequency adjusting --> porting adjtimex()


I’m porting the PTPd (Precission Time Protocol deamon) to QNX 6.3.

In Linux there is an adjtimex(2) kernel call for system clock adjusting (set to ADJ_FREQUENCY mode). It sets the system clock frequency offset, and gives a much finer adjustment than adjtime() function or ntpd.

Is there in QNX similiar system call witch can handle the system clock frequency to adjust the system clock???

I have tried is the ClockPeriod() call in QNX but it isn’t working well.

Thanks for any ideas :slight_smile:

Miroslav V.

What exactly does not work well with ClockPeriod()?

Ouch ClockPeriod isn’t meant to adjust the system time but the system tick size or timer resolution if you will. It’s resolution/precision is limited by the PC timer.

Check clock_settime()

I have checked clock_settime(). It’s not what I need.

I need to correct the system clock drift like the adjtimex() does. In linux there is the ability to set some frequency offset to system clock.

So I’m looking for any way how to handle the system clock that way in QNX.


ClockAdjust()? … tid=744634

Thank you,
that ptpd-qnx patch is quite helpfull :slight_smile:

Has anyone gotten ptpd to work with the QNX patch? I have applied the source code changes, but when I try to use it the ClockAdjust() does not appear to be working. The offset from master never changes. Does anyone have any ideas? Thanks!!

If anyone is wanting to use the ptpd-qnx patch. I found that the InterruptAttach() in sys.c, passes 0 as the intr parameter, I found that you should do a ‘pidin irq’ to find what interrupt procnto is actually using. Different processor types have different vector interrupt table values.

I haven’t look at the source, but does it also assume a certain rate? The rate can be changed at runtime though ClockPeriod().

A system clock of a radio telephone is adjusted in relation to an associated transmitter/receiver station system clock by detecting a predetermined part (SYNC word) which occurs periodically in a digital signal. A clock signal having pulses synchronous with the system clock signal of the radio telephone is formed. The clock pulses in the clock signal are counted between the detection of two predetermined parts in the digital signal, and the system clock is corrected in response to the number of pulses between the detection of said two predetermined parts in the digital signal.

70-642 practice exam | 70-646 practice exam | PMI-001 practice exam