From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Thu, 2 Mar 2023 13:00:40 +0000 (+0000) Subject: Fix a bug -- use the previous offset if a negative jitter for the first period. Fix... X-Git-Tag: 1.2~1^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b5490c2bf9d4fb391e933be9075b6fb32392522;p=thirdparty%2Fnqptp.git Fix a bug -- use the previous offset if a negative jitter for the first period. Fix a misleading comment. --- diff --git a/nqptp-message-handlers.c b/nqptp-message-handlers.c index ff07fcb..b84e1ec 100644 --- a/nqptp-message-handlers.c +++ b/nqptp-message-handlers.c @@ -441,10 +441,10 @@ void handle_follow_up(char *buf, ssize_t recv_len, clock_source_private_data *cl // smoothed_offset = clock_private_info->previous_offset + clamped_jitter / 16; // else - // ignore negative jitter for the first 10 seconds + // ignore negative jitter at first... + smoothed_offset = clock_private_info->previous_offset; if (mastership_time > 1000000000) - smoothed_offset = clock_private_info->previous_offset + - clamped_jitter / 64; // later, if jitter is negative + smoothed_offset += clamped_jitter / 64; // later, if jitter is negative } else if (mastership_time < 1000000000) { // at the beginning smoothed_offset = clock_private_info->previous_offset +