Hi,

i have an application which polls ptp clock and tries to execute some
activitites at specific times.

During printf debugging I have seen large jumps in the timespecs
returned by clock_gettime().

Using a Intel i5 with a  "Intel Corporation Ethernet Connection I217-V
(rev 05)"
network card around 100-200 calls to clock_gettime() in a loop are enough.

I have stripped my problem down to the following code, which fails if
between two inner loops the ptp time changes by more than a second:

Is this expected?

kind regards
  Frank

Using linuxptp-1.6 and kernel 3.16

$ phc2sys -v
1.6-00005-g8a79480

$ uname -v
#1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17)


#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>

int main(int argc, char *argv[])
{
    static const int CLOCKFD = 3;
    int fd = open("/dev/ptp0", O_RDONLY);
    clockid_t clkid = ((~(clockid_t)(fd) << 3) | CLOCKFD);

    struct timespec oldts;
    struct timespec newts;
    clock_gettime(clkid, &oldts);

    for(;;)
    {
       clock_gettime(clkid, &newts);
       time_t delta = newts.tv_sec - oldts.tv_sec;
       oldts = newts;
       assert(delta >= 0);
       assert(delta <= 1);

    }
}





------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to