> On Thu, Sep 13, 2012 at 11:20:24AM +0000, Koehrer Mathias (ETAS/ESS2) wrote: > | 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? > > CLOCK_MONOTONIC is not affected by NTP nor any adjusts to date and time > that the admin/user may perform. > > The only problem you could face would happen if the 'ts' value, third > parameter passed to clock_nanosleep, was coming from one system and being > used on both. Then, any difference between the clocks could lead to shorter > sleep times. Other than that, as far as manpages go, you seem to be safe. I want to ensure that after one day the very same number of cycles have been executed on PC-A and PC-B. Even if the internal clock of PC-A has a drift of 2s/day against that of PC-B. Using NTP the real time clock will be corrected - however the used function clock_nanosleep using CLOCK_MONOTONIC will not. Does this mean that I will have 2000 more millisecond cycles on the "faster PC" during a whole day? Regards Mathias -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html