Re: [Linuxptp-users] offset explosion and irregular phc offsets
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Julien H. <ju...@ya...> - 2013-08-13 08:44:15
|
> Can you be more specific? What have you changed? > Please show the diff. --- ./linuxptp-1.3/phc2sys.c 2013-08-02 11:24:40.000000000 +0200 +++ ./linuxptp-1.3.modified/phc2sys.c 2013-08-16 05:43:43.013228342 +0200 @@ -103,12 +103,9 @@ /* Pick the quickest clkid reading. */ for (i = 0; i < readings; i++) { - if (clock_gettime(sysclk, &tdst1) || - clock_gettime(clkid, &tsrc) || - clock_gettime(sysclk, &tdst2)) { - pr_err("failed to read clock: %m"); - return 0; - } + clock_getime(sysclk, &tdst1); + clock_gettime(clkid, &tsrc); + clock_gettime(sysclk, &tdst2); interval = (tdst2.tv_sec - tdst1.tv_sec) * NS_PER_SEC + tdst2.tv_nsec - tdst1.tv_nsec; @@ -510,10 +507,9 @@ it, as it is the clock which will include the leap second. */ if (clock->clkid != CLOCK_REALTIME) { struct timespec tp; - if (clock_gettime(CLOCK_REALTIME, &tp)) { - pr_err("failed to read clock: %m"); - return -1; - } + + clock_gettime(CLOCK_REALTIME, &tp); + ts = tp.tv_sec * NS_PER_SEC + tp.tv_nsec; } The clock_gettime returns an error flag but seems to do the job. > grep -nH -e "failed to read clock" * > phc2sys.c:109: pr_err("failed to read clock: %m"); > phc2sys.c:514: pr_err("failed to read clock: %m"); > Both of these cases should always work. If they don't, then your > system is broken. !!! It's strange, because I tried with a 3.9.11 kernel (with the included drivers) and I've got the same problem. I'm going to reinstall from the beginning. Thanks, Julien. |