[lkml]   [2015]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Regression: can't apply frequency offsets above 1000ppm.
On Wed, Sep 02, 2015 at 04:16:00PM -0700, John Stultz wrote:
> On Tue, Sep 1, 2015 at 6:14 PM, Nuno Gonçalves <> wrote:
> > And just installing chrony from the feeds. With any kernel from 3.17
> > you'll have wrong estimates at chronyc sourcestats.
> Wrong estimates? Could you be more specific about what the failure
> you're seeing is here? The
> I installed the image above, which comes with a 4.1.6 kernel, and
> chrony seems to have gotten my BBB into ~1ms sync w/ servers over the
> internet fairly quickly (at least according to chronyc tracking).

To see the bug with chronyd the initial offset shouldn't be very close
to zero, so it's forced to correct the offset by adjusting the
frequency in a larger step.

I'm attaching a simple C program that prints the frequency offset
as measured between the REALTIME and MONOTONIC_RAW clocks when the
adjtimex tick is set to 9000. It should show values close to -100000
ppm and I suspect on the BBB it will be much smaller.

Miroslav Lichvar
#include <stdio.h>
#include <sys/timex.h>
#include <time.h>
#include <unistd.h>

#define DIFFTS(a, b) ((a.tv_sec - b.tv_sec) + 1e-9 * (a.tv_nsec - b.tv_nsec))

int main() {
struct timespec ts1, ts2, ts3, ts4 = {0};
struct timex t;

t.modes = ADJ_TICK;
t.tick = 9000;
if (adjtimex(&t) < 0)
return 1;

while (1) {
clock_gettime(CLOCK_REALTIME, &ts1);
clock_gettime(CLOCK_MONOTONIC_RAW, &ts2);

if (ts4.tv_sec)
printf("freq offset = %.0f ppm\n",
(DIFFTS(ts1, ts3) / DIFFTS(ts2, ts4) - 1.0) * 1e6);

ts3 = ts1;
ts4 = ts2;

return 0;
 \ /
  Last update: 2015-09-03 13:41    [W:0.063 / U:7.008 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site