struct ptp_follow_up_message *msg = (struct ptp_follow_up_message *)buf;
+
uint16_t seconds_hi = nctohs(&msg->follow_up.preciseOriginTimestamp[0]);
uint32_t seconds_low = nctohl(&msg->follow_up.preciseOriginTimestamp[2]);
uint32_t nanoseconds = nctohl(&msg->follow_up.preciseOriginTimestamp[6]);
preciseOriginTimestamp = preciseOriginTimestamp + nanoseconds;
// update our sample information
+ if (clock_private_info->follow_up_number < 100)
+ clock_private_info->follow_up_number++;
clock_private_info->announcements_without_followups = 0; // we've seen a followup
} else if (clock_private_info->previous_offset_time != 0) {
// i.e. if it's not becoming a master and there has been a previous follow_up
int64_t time_since_last_sync = reception_time - clock_private_info->last_sync_time;
- int64_t sync_timeout = 60000000000; // nanoseconds
+ int64_t sync_timeout = 15000000000; // nanoseconds
debug(2, "Sync interval: %f seconds.", 0.000000001 * time_since_last_sync);
if (time_since_last_sync < sync_timeout) {
// Do acceptance checking.
// If the new offset is greater, by any amount, than the old offset,
- // accept it.
- // If it is less than the new offset by up to what a reasonable drift divergence would allow,
+ // or if it is less by up to 10 mS,
// accept it.
// Otherwise, reject it
- // A drift divergence of 100 ppm would give 12.5 us per 125 ms.
-
jitter = offset - clock_private_info->previous_offset;
- uint64_t jitter_timing_interval = reception_time - clock_private_info->previous_offset_time;
- long double jitterppm = 0.0;
- if (jitter_timing_interval != 0) {
- jitterppm = (0.001 * (jitter * 1000000000)) / jitter_timing_interval;
- debug(2, "jitter: %" PRId64 " in: %" PRId64 " ns, %+f ppm ", jitter, jitter_timing_interval,
- jitterppm);
- }
- if (jitterppm >= -1000) {
- // we take a positive or small negative jitter as a sync event
- // as we have a new figure for the difference between the local clock and the
- // remote clock which is almost the same or greater than our previous estimate
+ if (jitter > -10000000) {
+ // we take any positive or a limited negative jitter as a sync event
+ if (jitter < 0)
+ offset = clock_private_info->previous_offset + jitter/32;
+ else
+ offset = clock_private_info->previous_offset + jitter/32;
clock_private_info->last_sync_time = reception_time;
} else {
- // let our previous estimate drop fall back by this many nanoseconds
- jitter = -10 * 1000; // this is nanoseconds in, supposedly, 125 milliseconds. 12.5 us /
- // 125 ms is 100 ppm.
- offset = clock_private_info->previous_offset + jitter;
+ offset = clock_private_info->previous_offset; // forget the present sample...
}
} else {
if ((clock_private_info->flags & (1 << clock_is_master)) != 0)
clock_private_info->previous_offset_time = reception_time;
if ((clock_private_info->flags & (1 << clock_is_master)) != 0) {
+
update_master_clock_info(clock_private_info->clock_id, (const char *)&clock_private_info->ip,
reception_time, offset, clock_private_info->mastership_start_time);
debug(3, "clock: %" PRIx64 ", time: %" PRIu64 ", offset: %" PRId64 ", jitter: %+f ms.",