Maintain the current data set.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-08-22 07:25:46 +02:00
parent b2e8555ffd
commit 92c6c9149d
2 changed files with 9 additions and 0 deletions

View File

@ -570,6 +570,8 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx,
c->path_delay = mave_accumulate(c->avg_delay, pd); c->path_delay = mave_accumulate(c->avg_delay, pd);
c->cur.meanPathDelay = tmv_to_TimeInterval(c->path_delay);
pr_debug("path delay %10lld %10lld", c->path_delay, pd); pr_debug("path delay %10lld %10lld", c->path_delay, pd);
} }
@ -627,6 +629,8 @@ enum servo_state clock_synchronize(struct clock *c,
c->master_offset = tmv_sub(ingress, c->master_offset = tmv_sub(ingress,
tmv_add(origin, tmv_add(c->path_delay, tmv_add(c->c1, c->c2)))); tmv_add(origin, tmv_add(c->path_delay, tmv_add(c->c1, c->c2))));
c->cur.offsetFromMaster = tmv_to_TimeInterval(c->master_offset);
if (!c->path_delay) if (!c->path_delay)
return state; return state;

5
tmv.h
View File

@ -71,6 +71,11 @@ static inline tmv_t correction_to_tmv(Integer64 c)
return c >> 16; return c >> 16;
} }
static inline TimeInterval tmv_to_TimeInterval(tmv_t x)
{
return x << 16;
}
static inline tmv_t timespec_to_tmv(struct timespec ts) static inline tmv_t timespec_to_tmv(struct timespec ts)
{ {
return ts.tv_sec * NS_PER_SEC + ts.tv_nsec; return ts.tv_sec * NS_PER_SEC + ts.tv_nsec;