Thread (5 messages) 5 messages, 3 authors, 2012-09-13

clock_nanosleep and NTP drift correction

flat view

From: Koehrer Mathias (ETAS/ESS2) <hidden>
Date: 2012-09-13 11:20:26

Hi all!

I have two x86 PCs running with the RT_PREEMPT patch (2.6.33.x).
Both PCs run a real time application with a thread that will be executed periodically every 1ms.
For this I use a
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL);
within the application's main loop.
The value of "ts" will be incremented after every call.

Both PCs (PC-A, PC-B) are connected via Ethernet to a third PC (PC-C) that acts as NTP time server for the other PCs (PC-A and PC-B).

My question is now:
Does clock_nanosleep() consider a potential time drift that is corrected by NTP?
Or: Will there be a significant drift between both PCs (PC-A, PC-B) by using this approach?

As the application runs very long (hours or even days) I am looking for a solution that avoids 
large drifts between the two systems.
Deltas of 1 or 2 ms are acceptable, but no time differences in tens of milliseconds.

Thanks for any help or feedback on this question

Best regards

Mathias

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help