From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Sun, 28 Nov 2021 16:05:49 +0000 (+0000) Subject: Move to using CLOCK_MONOLITHIC_RAW to avoid NTP effects. Increase bias towards positi... X-Git-Tag: 1.2~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3180afc331b09b45c3cec0d96e7176c8ac5eff65;p=thirdparty%2Fnqptp.git Move to using CLOCK_MONOLITHIC_RAW to avoid NTP effects. Increase bias towards positive jitter changes. Bump interface version. --- diff --git a/general-utilities.c b/general-utilities.c index 1a89578..6af2977 100644 --- a/general-utilities.c +++ b/general-utilities.c @@ -66,6 +66,6 @@ uint64_t timespec_to_ns(struct timespec *tn) { uint64_t get_time_now() { struct timespec tn; - clock_gettime(CLOCK_REALTIME, &tn); // this should be optionally CLOCK_MONOTONIC etc. + clock_gettime(CLOCK_MONOTONIC_RAW, &tn); return timespec_to_ns(&tn); } diff --git a/nqptp-message-handlers.c b/nqptp-message-handlers.c index 562a57e..1637111 100644 --- a/nqptp-message-handlers.c +++ b/nqptp-message-handlers.c @@ -387,11 +387,11 @@ void handle_follow_up(char *buf, __attribute__((unused)) ssize_t recv_len, 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 / 16; + offset = clock_private_info->previous_offset + jitter / 32; else if (clock_private_info->follow_up_number < (5 * 8)) // at the beginning (8 samples per second) offset = clock_private_info->previous_offset + jitter / 2; // accept positive changes quickly else - offset = clock_private_info->previous_offset + jitter / 16; + offset = clock_private_info->previous_offset + jitter / 2; clock_private_info->last_sync_time = reception_time; } else { offset = clock_private_info->previous_offset; // forget the present sample... diff --git a/nqptp-shm-structures.h b/nqptp-shm-structures.h index 36c8a81..f4db8c6 100644 --- a/nqptp-shm-structures.h +++ b/nqptp-shm-structures.h @@ -22,7 +22,7 @@ #define STORAGE_ID "/nqptp" #define MAX_CLOCKS 32 -#define NQPTP_SHM_STRUCTURES_VERSION 5 +#define NQPTP_SHM_STRUCTURES_VERSION 6 #define NQPTP_CONTROL_PORT 9000 // the control port will accept a UDP packet with the first letter being: