I believe it would be the kernel and not glibc, since I think I’m ending up
with this code from missing.h, which directly issues a syscall:
#ifndef HAVE_CLOCK_ADJTIME
static inline int clock_adjtime(clockid_t id, struct timex *tx)
{
return syscall(__NR_clock_adjtime, id, tx);
}
#endif
Brian Olson
br...@amergint.com
719-522-2808
"we mutually pledge to each other our Lives, our Fortunes and our sacred Honor."
> On Jun 13, 2017, at 12:02 PM, Brian Olson <br...@amergint.com> wrote:
>
> I agree.
>
> I made a change and now it converges:
> 2017-06-13T13:59:05.703456-04:00 bco2 phc2sys: [27.336] reconfiguring after
> port state change
> 2017-06-13T13:59:05.703467-04:00 bco2 phc2sys: [27.336] selecting
> CLOCK_REALTIME for synchronization
> 2017-06-13T13:59:05.703474-04:00 bco2 phc2sys: [27.336] selecting eth2 as the
> master clock
> 2017-06-13T13:59:05.703523-04:00 bco2 phc2sys: [27.336] phc offset 168017291
> s0 freq -0 delay 47
> 2017-06-13T13:59:06.703660-04:00 bco2 phc2sys: [28.337] phc offset 167991798
> s0 freq -0 delay 49
> 2017-06-13T13:59:07.703828-04:00 bco2 phc2sys: [29.337] phc offset 167966620
> s0 freq -0 delay 42
> 2017-06-13T13:59:08.536030-04:00 bco2 phc2sys: [30.337] phc offset 167941573
> s1 freq -25332 delay 45
> 2017-06-13T13:59:09.536165-04:00 bco2 phc2sys: [31.337] phc offset -360
> s2 freq -25469 delay 50
> 2017-06-13T13:59:10.536299-04:00 bco2 phc2sys: [32.337] phc offset 168
> s2 freq -25200 delay 45
>
>
> diff --git a/clockadj.c b/clockadj.c
> index 5eb7cce..86c7b33 100644
> --- a/clockadj.c
> +++ b/clockadj.c
> @@ -73,7 +73,7 @@ double clockadj_get_freq(clockid_t clkid)
> pr_err("failed to read out the clock frequency adjustment:
> %m");
> } else {
> f = tx.freq / 65.536;
> - if (clkid == CLOCK_REALTIME && realtime_nominal_tick)
> + if (clkid == CLOCK_REALTIME && realtime_nominal_tick &&
> tx.tick)
> f += 1e3 * realtime_hz * (tx.tick -
> realtime_nominal_tick);
>
>
> I think this older version of the kernel (2.6.32-504.el6.x86_64) is
> returning 0 for tx.tick.
>
> Any thoughts on whether this is a valid fix?
>
> I also had to make another small change to get the latest code to build on
> RHEL 6.8:
>
> diff --git a/rtnl.c b/rtnl.c
> index 251b5f3..1266731 100644
> --- a/rtnl.c
> +++ b/rtnl.c
> @@ -17,6 +17,7 @@
> * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> */
> #include <asm/types.h>
> +#include <sys/socket.h>
> #include <linux/netlink.h>
> #include <linux/rtnetlink.h>
> #include <net/if.h>
>
> thanks for looking at this.
>
> Brian Olson
> br...@amergint.com <mailto:br...@amergint.com>
> 719-522-2808
> "we mutually pledge to each other our Lives, our Fortunes and our sacred
> Honor."
>
>
>
>> On Jun 13, 2017, at 11:55 AM, Miroslav Lichvar <mlich...@redhat.com
>> <mailto:mlich...@redhat.com>> wrote:
>>
>> On Tue, Jun 13, 2017 at 10:35:42AM -0600, Brian Olson wrote:
>>> double clockadj_get_freq(clockid_t clkid)
>>> {
>>> double f = 0.0;
>>> struct timex tx;
>>> memset(&tx, 0, sizeof(tx));
>>> if (clock_adjtime(clkid, &tx) < 0) {
>>
>> From your logs it seems the problem is that clock_adjtime() returns
>> zero ticks instead of 10000 for the REALTIME clock. I suspect it's a
>> kernel or possibly glibc bug.
>>
>> --
>> Miroslav Lichvar
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users